FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

stable state of statusPanel · Jonham/processing@15339b5 · GitHub

Repository navigation

Commit 15339b5

Browse files
committed
stable state of statusPanel
1 parent 4f6c718 commit 15339b5

3 files changed

Lines changed: 32 additions & 22 deletions

File tree

‎app/src/processing/app/contrib/ContributionListPanel.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public void hyperlinkUpdate(HyperlinkEvent e) { }
5050

5151
private ContributionPanel selectedPanel;
5252
// protected JPanel statusPlaceholder;
53-
private StatusPanel status;
53+
// private StatusPanel status;
5454
private ContributionFilter filter;
5555
// private ContributionListing contribListing;
5656
private ContributionListing contribListing = ContributionListing.getInstance();
@@ -81,7 +81,7 @@ public ContributionListPanel(ContributionTab contributionTab,
8181

8282
// statusPlaceholder = new JPanel();
8383
// statusPlaceholder.setVisible(false);
84-
status = new StatusPanel();
84+
// status = new StatusPanel(null);
8585
}
8686

8787

@@ -97,15 +97,15 @@ private void updatePanelOrdering() {
9797

9898
add(entry.getValue(), c);
9999
}
100-
100+
/*
101101
GridBagConstraints c = new GridBagConstraints();
102102
c.fill = GridBagConstraints.BOTH;
103103
c.weightx = 1;
104104
c.weighty = 1;
105105
c.gridx = 0;
106106
c.gridy = row++;
107107
c.anchor = GridBagConstraints.NORTH;
108-
add(status, c);
108+
add(status, c);*/
109109
}
110110

111111

‎app/src/processing/app/contrib/ContributionTab.java‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,10 @@ public void itemStateChanged(ItemEvent arg0) {
287287
pane.add(Box.createHorizontalStrut(10), BorderLayout.WEST);
288288
pane.add(Box.createHorizontalStrut(10), BorderLayout.EAST);
289289

290-
status = new StatusPanel();
290+
status = new StatusPanel(450);
291291
// status.setBorder(new EmptyBorder(7, 7, 7, 7));
292292

293-
JPanel statusRestartPane = new JPanel();
293+
/*JPanel statusRestartPane = new JPanel();
294294
statusRestartPane.setLayout(new BorderLayout());
295295
296296
statusRestartPane.setBorder(new EmptyBorder(7, 7, 7, 7));
@@ -302,9 +302,9 @@ public void itemStateChanged(ItemEvent arg0) {
302302
// Adding both of these to EAST shouldn't pose too much of a problem,
303303
// since they can never get added together.
304304
statusRestartPane.add(restartButton, BorderLayout.EAST);
305-
statusRestartPane.add(retryConnectingButton, BorderLayout.EAST);
305+
statusRestartPane.add(retryConnectingButton, BorderLayout.EAST);*/
306306

307-
pane.add(statusRestartPane, BorderLayout.SOUTH);
307+
pane.add(status, BorderLayout.SOUTH);
308308

309309

310310
// status = new StatusPanel();

‎app/src/processing/app/contrib/StatusPanel.java‎

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,34 @@
2828
import javax.swing.JLabel;
2929
import javax.swing.JPanel;
3030
import javax.swing.JProgressBar;
31+
import javax.swing.LayoutStyle;
3132
import javax.swing.SwingConstants;
3233

3334

3435
class StatusPanel extends JPanel {
3536

37+
final int BUTTON_WIDTH = 20;
38+
3639
JLabel label;
3740
JButton installButton;
3841
JProgressBar installProgressBar;
3942
JLabel upadteLabel;
4043
JButton upadteButton;
4144
JButton removeButton;
4245

43-
public StatusPanel() {
46+
public StatusPanel(int width) {
47+
48+
final int BUTTON_WIDTH = 20;
4449

4550
label = new JLabel("");
4651
installButton = new JButton("Install");
4752
installProgressBar = new JProgressBar();
4853
upadteLabel = new JLabel("Update to Infinite 1.1");
4954
upadteButton = new JButton("Update");
5055
removeButton = new JButton("Remove");
51-
56+
57+
int labelWidth = width != 0 ? width * 2 / 3 : GroupLayout.PREFERRED_SIZE;
58+
this.setSize(450, 200);
5259
GroupLayout layout = new GroupLayout(this);
5360
this.setLayout(layout);
5461

@@ -57,29 +64,32 @@ public StatusPanel() {
5764

5865
layout.setHorizontalGroup(layout
5966
.createSequentialGroup()
60-
.addComponent(label)
61-
.addGroup(layout.createParallelGroup()
62-
.addComponent(installButton, GroupLayout.Alignment.CENTER)
63-
.addComponent(installProgressBar, GroupLayout.Alignment.CENTER)
64-
.addComponent(upadteLabel, GroupLayout.Alignment.CENTER)
65-
.addComponent(upadteButton, GroupLayout.Alignment.CENTER)
66-
.addComponent(removeButton, GroupLayout.Alignment.CENTER)));
67+
.addComponent(label, labelWidth, labelWidth, labelWidth)
68+
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,
69+
GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
70+
.addGroup(layout
71+
.createParallelGroup(GroupLayout.Alignment.CENTER)
72+
.addComponent(installButton, BUTTON_WIDTH, BUTTON_WIDTH,
73+
BUTTON_WIDTH).addComponent(installProgressBar)
74+
.addComponent(upadteLabel).addComponent(upadteButton)
75+
.addComponent(removeButton)));
6776

6877
layout.setVerticalGroup(layout
6978
.createParallelGroup()
7079
.addComponent(label)
71-
.addGroup(layout.createSequentialGroup()
80+
.addGroup(layout
81+
.createSequentialGroup()
7282
.addComponent(installButton)
7383
.addGroup(layout.createParallelGroup()
7484
.addComponent(installProgressBar)
7585
.addComponent(upadteLabel))
7686
.addComponent(upadteButton).addComponent(removeButton)));
77-
78-
layout.linkSize(SwingConstants.HORIZONTAL, installButton,
79-
installProgressBar, upadteLabel, upadteButton, removeButton);
87+
88+
layout
89+
.linkSize(SwingConstants.HORIZONTAL, installButton, installProgressBar,
90+
upadteLabel, upadteButton, removeButton);
8091

8192
installProgressBar.setVisible(false);
82-
8393
}
8494

8595
void setMessage(String message) {

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL