mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Formatting and comments
This commit is contained in:
@@ -500,7 +500,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
|
||||
setFocusable(true);
|
||||
setLayout(new GridBagLayout());
|
||||
|
||||
{
|
||||
{ // Header text area. The name of the contribution and its authors.
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridx = 0;
|
||||
c.gridy = 0;
|
||||
@@ -514,7 +514,8 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
|
||||
add(headerText, c);
|
||||
}
|
||||
|
||||
{
|
||||
{ // The category label, which shows the names of the category in the
|
||||
// upper left corner.
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridx = 1;
|
||||
c.gridy = 0;
|
||||
@@ -525,7 +526,9 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
|
||||
add(categoryLabel, c);
|
||||
}
|
||||
|
||||
{
|
||||
{ // The bottom part of the panel which describes the contribution.
|
||||
// All components in the description (e.g. icons, text) are placed in
|
||||
// the descriptionPanel
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridx = 0;
|
||||
c.gridy = 1;
|
||||
@@ -539,8 +542,10 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
|
||||
descriptionPanel.setOpaque(false);
|
||||
descriptionPanel.setLayout(new GridBagLayout());
|
||||
add(descriptionPanel, c);
|
||||
|
||||
c = new GridBagConstraints();
|
||||
}
|
||||
|
||||
{ // The left part of the description, used to draw the icon.
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridx = 0;
|
||||
c.gridy = 0;
|
||||
c.gridheight = 2;
|
||||
@@ -564,7 +569,7 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
|
||||
descriptionPanel.add(iconArea, c);
|
||||
}
|
||||
|
||||
{
|
||||
{ // The bottom right of the description, used to show text describing it
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridx = 1;
|
||||
c.gridy = 0;
|
||||
@@ -580,7 +585,9 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
|
||||
descriptionPanel.add(descriptionText, c);
|
||||
}
|
||||
|
||||
{
|
||||
{ // A label below the description text showing notifications for when
|
||||
// updates are available, or instructing the user to restart the PDE if
|
||||
// necessary
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridx = 1;
|
||||
c.gridy = 1;
|
||||
@@ -596,7 +603,8 @@ public class ContributionListPanel extends JPanel implements Scrollable, Contrib
|
||||
descriptionPanel.add(updateNotificationLabel, c);
|
||||
}
|
||||
|
||||
{
|
||||
{ // An update button, shown in the description area, but only visible for
|
||||
// contributions that do not require a restart.
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridx = 2;
|
||||
c.gridy = 1;
|
||||
|
||||
@@ -184,67 +184,91 @@ public class ContributionManager {
|
||||
dialog.dispose();
|
||||
editor = null;
|
||||
}
|
||||
|
||||
|
||||
/** Creates and arranges the Swing components in the dialog. */
|
||||
private void createComponents() {
|
||||
dialog.setResizable(true);
|
||||
|
||||
Container pane = dialog.getContentPane();
|
||||
pane.setLayout(new GridBagLayout());
|
||||
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridx = 0;
|
||||
c.gridy = 0;
|
||||
c.gridwidth = 2;
|
||||
c.weightx = 1;
|
||||
c.fill = GridBagConstraints.HORIZONTAL;
|
||||
filterField = new FilterField();
|
||||
{ // The filter text area
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridx = 0;
|
||||
c.gridy = 0;
|
||||
c.gridwidth = 2;
|
||||
c.weightx = 1;
|
||||
c.fill = GridBagConstraints.HORIZONTAL;
|
||||
filterField = new FilterField();
|
||||
|
||||
pane.add(filterField, c);
|
||||
}
|
||||
|
||||
pane.add(filterField, c);
|
||||
{ // The scroll area containing the contribution listing.
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.fill = GridBagConstraints.BOTH;
|
||||
c.gridx = 0;
|
||||
c.gridy = 1;
|
||||
c.gridwidth = 2;
|
||||
c.weighty = 1;
|
||||
c.weightx = 1;
|
||||
|
||||
final JScrollPane scrollPane = new JScrollPane();
|
||||
scrollPane.setPreferredSize(new Dimension(300, 300));
|
||||
scrollPane.setViewportView(contributionListPanel);
|
||||
scrollPane.getViewport().setOpaque(true);
|
||||
|
||||
scrollPane.getViewport().setBackground(contributionListPanel
|
||||
.getBackground());
|
||||
|
||||
scrollPane
|
||||
.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
pane.add(scrollPane, c);
|
||||
// pane.add(scrollPane, c);
|
||||
scrollPane
|
||||
.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
}
|
||||
|
||||
c = new GridBagConstraints();
|
||||
c.fill = GridBagConstraints.BOTH;
|
||||
c.gridx = 0;
|
||||
c.gridy = 1;
|
||||
c.gridwidth = 2;
|
||||
c.weighty = 1;
|
||||
c.weightx = 1;
|
||||
{ // Shows "Category:"
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.gridx = 0;
|
||||
c.gridy = 2;
|
||||
pane.add(new Label("Category:"), c);
|
||||
}
|
||||
|
||||
final JScrollPane scrollPane = new JScrollPane();
|
||||
scrollPane.setPreferredSize(new Dimension(300,300));
|
||||
scrollPane.setViewportView(contributionListPanel);
|
||||
scrollPane.getViewport().setOpaque(true);
|
||||
|
||||
scrollPane.getViewport().setBackground(contributionListPanel.getBackground());
|
||||
|
||||
scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
|
||||
pane.add(scrollPane, c);
|
||||
//pane.add(scrollPane, c);
|
||||
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
|
||||
c = new GridBagConstraints();
|
||||
c.gridx = 0;
|
||||
c.gridy = 2;
|
||||
pane.add(new Label("Category:"), c);
|
||||
|
||||
c = new GridBagConstraints();
|
||||
c.fill = GridBagConstraints.HORIZONTAL;
|
||||
c.gridx = 1;
|
||||
c.gridy = 2;
|
||||
|
||||
categoryChooser = new JComboBox();
|
||||
updateCategoryChooser();
|
||||
pane.add(categoryChooser, c);
|
||||
categoryChooser.addItemListener(new ItemListener() {
|
||||
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
category = (String) categoryChooser.getSelectedItem();
|
||||
if (ContributionManager.ANY_CATEGORY.equals(category)) {
|
||||
category = null;
|
||||
{ // Combo box for selecting a category
|
||||
GridBagConstraints c = new GridBagConstraints();
|
||||
c.fill = GridBagConstraints.HORIZONTAL;
|
||||
c.gridx = 1;
|
||||
c.gridy = 2;
|
||||
|
||||
categoryChooser = new JComboBox();
|
||||
updateCategoryChooser();
|
||||
pane.add(categoryChooser, c);
|
||||
categoryChooser.addItemListener(new ItemListener() {
|
||||
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
category = (String) categoryChooser.getSelectedItem();
|
||||
if (ContributionManager.ANY_CATEGORY.equals(category)) {
|
||||
category = null;
|
||||
}
|
||||
|
||||
filterLibraries(category, filterField.filters);
|
||||
}
|
||||
|
||||
filterLibraries(category, filterField.filters);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// {
|
||||
// GridBagConstraints c = new GridBagConstraints();
|
||||
// c.fill = GridBagConstraints.HORIZONTAL;
|
||||
// c.gridx = 0;
|
||||
// c.gridy = 3;
|
||||
// c.gridwidth = 2;
|
||||
// JLabel statusLabel = new JLabel("Hello there. This is some text.");
|
||||
// statusLabel.setOpaque(true);
|
||||
// statusLabel.setBackground(Color.black);
|
||||
// pane.add(statusLabel, c);
|
||||
// }
|
||||
|
||||
dialog.setMinimumSize(new Dimension(550, 400));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user