3838public class ManagerFrame {
3939 static final String ANY_CATEGORY = Language .text ("contrib.all" );
4040
41- // static final int TAB_WIDTH = 100;
42- // static final int TAB_HEIGHT = 34;
43- static final int AUTHOR_WIDTH = 240 ;
44- static final int STATUS_WIDTH = 66 ;
41+ static final int AUTHOR_WIDTH = Toolkit .zoom (240 );
42+ static final int STATUS_WIDTH = Toolkit .zoom (66 );
4543
4644 static final String title = "Contribution Manager" ;
4745
4846 Base base ;
4947 JFrame frame ;
50- // JTabbedPane tabbedPane;
5148 ManagerTabs tabs ;
5249
53- // the calling editor, so updates can be applied
54- // Editor editor;
55-
5650 ContributionTab librariesTab ;
5751 ContributionTab modesTab ;
5852 ContributionTab toolsTab ;
5953 ContributionTab examplesTab ;
6054 UpdateContributionTab updatesTab ;
61- // JLabel numberLabel;
62-
63- // private JLabel[] tabLabels;
64- // private JPanel updateTabPanel;
65- // private JLabel updateTabLabel;
6655
6756
6857 public ManagerFrame (Base base ) {
6958 this .base = base ;
7059
71- // numberLabel = new JLabel(Toolkit.getLibIconX("manager/notification"));
7260 librariesTab = new ContributionTab (this , ContributionType .LIBRARY );
7361 modesTab = new ContributionTab (this , ContributionType .MODE );
7462 toolsTab = new ContributionTab (this , ContributionType .TOOL );
@@ -77,11 +65,7 @@ public ManagerFrame(Base base) {
7765 }
7866
7967
80- // TODO remove this Editor... need to use Base.getActiveEditor()
81- // The editor may be closed while still running the contrib manager
8268 public void showFrame (ContributionType contributionType ) {
83- // this.editor = editor;
84-
8569 ContributionTab showTab = getTab (contributionType );
8670 if (frame == null ) {
8771 makeFrame ();
@@ -100,7 +84,7 @@ public void showFrame(ContributionType contributionType) {
10084
10185 private void makeFrame () {
10286 frame = new JFrame (title );
103- frame .setMinimumSize (new Dimension (750 , 500 ));
87+ frame .setMinimumSize (Toolkit . zoom (750 , 500 ));
10488 tabs = new ManagerTabs (base );
10589
10690 makeAndShowTab (false , true );
@@ -111,129 +95,7 @@ private void makeFrame() {
11195 tabs .addPanel (examplesTab , "Examples" );
11296 tabs .addPanel (updatesTab , "Updates" );
11397
114- /*
115- tabbedPane.addTab("Libraries", null, librariesTab, "Libraries");
116- tabbedPane.setMnemonicAt(0, KeyEvent.VK_1);
117-
118- tabbedPane.addTab("Modes", null, modesTab, "Modes");
119- tabbedPane.setMnemonicAt(1, KeyEvent.VK_2);
120-
121- tabbedPane.addTab("Tools", null, toolsTab, "Tools");
122- tabbedPane.setMnemonicAt(2, KeyEvent.VK_3);
123-
124- tabbedPane.addTab("Examples", null, examplesTab, "Examples");
125- tabbedPane.setMnemonicAt(3, KeyEvent.VK_4);
126-
127- tabbedPane.addTab("Updates", null, updatesTab, "Updates");
128- tabbedPane.setMnemonicAt(4, KeyEvent.VK_5);
129-
130- tabbedPane.setUI(new SpacedTabbedPaneUI());
131- tabbedPane.setBackground(new Color(0x132638));
132- tabbedPane.setOpaque(true);
133-
134- for (int i = 0; i < 5; i++) {
135- tabbedPane.setToolTipTextAt(i, null);
136- }
137- */
138-
139- /*
140- final String[] tabTitles = {
141- "Libraries", "Modes", "Tools", "Examples", "Updates"
142- };
143- tabLabels = new JLabel[4];
144-
145- for (int i = 0 ; i < 4; i++) {
146- final int temp = i;
147- tabLabels[i] = new JLabel(tabTitles[i]) {
148- @Override
149- protected void paintComponent(Graphics g) {
150- g.setClip(Toolkit.createRoundRect(0, 0,
151- getWidth(), getHeight(),
152- temp == 0 ? 6 : 0,
153- temp == 3 ? 6 : 0,
154- 0, 0));
155- super.paintComponent(g);
156- }
157- };
158- tabLabels[i].setForeground(Color.WHITE);
159- tabLabels[i].setBackground(new Color(0x2d4251));
160- tabLabels[i].setOpaque(true);
161- tabLabels[i].setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
162- tabLabels[i].setPreferredSize(new Dimension(TAB_WIDTH, TAB_HEIGHT));
163- tabLabels[i].setHorizontalAlignment(SwingConstants.CENTER);
164- tabLabels[i].setFont(Toolkit.getSansFont(14, Font.BOLD));
165- tabbedPane.setTabComponentAt(i, tabLabels[i]);
166- }
167- */
168-
169- /*
170- updateTabPanel = new JPanel() {
171- @Override
172- protected void paintComponent(Graphics g) {
173- g.setClip(Toolkit.createRoundRect(0, 0, getWidth(), getHeight(),
174- 6, 6, 0, 0));
175- super.paintComponent(g);
176- }
177- };;
178- updateTabLabel = new JLabel("Updates");
179- updateTabLabel.setFont(Toolkit.getSansFont(14, Font.BOLD));
180- numberLabel.setVerticalTextPosition(SwingConstants.CENTER);
181- numberLabel.setHorizontalTextPosition(SwingConstants.CENTER);
182- numberLabel.setFont(Toolkit.getSansFont(14, Font.BOLD));
183- numberLabel.setForeground(Color.WHITE);
184- updateTabPanel.setOpaque(true);
185- updateTabPanel.setBackground(new Color(0x2d4251));
186- updateTabLabel.setForeground(Color.WHITE);
187- updateTabPanel.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
188- updateTabPanel.setPreferredSize(new Dimension(TAB_WIDTH, TAB_HEIGHT));
189- tabbedPane.setTabComponentAt(4, updateTabPanel);
190- */
191-
192- /*
193- GroupLayout tabLayout = new GroupLayout(updateTabPanel);
194- tabLayout.setAutoCreateGaps(true);
195- updateTabPanel.setLayout(tabLayout);
196- tabLayout.setHorizontalGroup(tabLayout
197- .createSequentialGroup()
198- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,
199- GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
200- .addComponent(updateTabLabel)
201- .addComponent(numberLabel)
202- .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,
203- GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE));
204- tabLayout.setVerticalGroup(tabLayout
205- .createParallelGroup(GroupLayout.Alignment.CENTER)
206- .addComponent(numberLabel).addComponent(updateTabLabel));
207-
208- numberLabel.setVisible(false);
209- */
210-
211- /*
212- tabbedPane.addChangeListener(new ChangeListener() {
213-
214- @Override
215- public void stateChanged(ChangeEvent e) {
216- for(int i = 0 ; i < 4; i++){
217- tabLabels[i].setBackground(new Color(0x2d4251));
218- tabLabels[i].setForeground(Color.WHITE);
219- }
220- updateTabPanel.setBackground(new Color(0x2d4251));
221- updateTabLabel.setForeground(Color.WHITE);
222- int currentIndex = tabbedPane.getSelectedIndex();
223- if(currentIndex != 4){
224- tabbedPane.getTabComponentAt(tabbedPane.getSelectedIndex()).setBackground(new Color(0xe0fffd));
225- tabbedPane.getTabComponentAt(tabbedPane.getSelectedIndex()).setForeground(Color.BLACK);
226- }else{
227- updateTabPanel.setBackground(new Color(0xe0fffd));
228- updateTabLabel.setForeground(Color.BLACK);
229- }
230- getActiveTab().contributionListPanel.scrollPane.requestFocusInWindow();
231- }
232- });
233- */
234-
23598 frame .setResizable (true );
236- // tabbedPane.setBorder(new EmptyBorder(BORDER, BORDER, BORDER, BORDER));
23799
238100 Container c = frame .getContentPane ();
239101 c .add (tabs );
@@ -255,73 +117,7 @@ public void stateChanged(ChangeEvent e) {
255117 */
256118 protected void disposeFrame () {
257119 frame .dispose ();
258- // editor = null;
259- }
260-
261-
262- // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
263-
264-
265- /*
266- private class SpacedTabbedPaneUI extends BasicTabbedPaneUI {
267-
268- @Override
269- protected void installDefaults() {
270- UIManager.put("TabbedPane.selected", Color.BLACK);
271- UIManager.put("TabbedPane.tabsOverlapBorder" , true);
272- super.installDefaults();
273- tabInsets = new Insets(0, 0, 0, 0);
274- contentBorderInsets = new Insets(0, 0, 0, 0);
275- tabAreaInsets = new Insets(0, 0, 0, 0);
276- selectedTabPadInsets = new Insets(0, 0, 0, 0);
277- }
278-
279-
280- @Override
281- protected int getTabLabelShiftY(int tabPlacement, int tabIndex,
282- boolean isSelected) {
283- return 1;
284- }
285-
286-
287- @Override
288- protected void paintTabBackground(Graphics g, int tabPlacement,
289- int tabIndex, int x, int y, int w, int h,
290- boolean isSelected) {
291- }
292-
293-
294- @Override
295- protected void paintTabBorder(Graphics g, int tabPlacement, int tabIndex,
296- int x, int y, int w, int h, boolean isSelected) {
297- }
298-
299-
300- @Override
301- protected void paintFocusIndicator(Graphics g, int tabPlacement,
302- Rectangle[] rects, int tabIndex,
303- Rectangle iconRect, Rectangle textRect,
304- boolean isSelected) {
305- }
306-
307-
308- @Override
309- protected LayoutManager createLayoutManager() {
310- return new BasicTabbedPaneUI.TabbedPaneLayout() {
311-
312- @Override
313- protected void calculateTabRects(int tabPlacement, int tabCount) {
314- super.calculateTabRects(tabPlacement, tabCount);
315- rects[0].x -= 2;
316- rects[1].x -= 1;
317- rects[2].x -= 1;
318- rects[3].x -= 1;
319- rects[4].x = tabbedPane.getWidth() - rects[4].width + 1;
320- }
321- };
322- }
323120 }
324- */
325121
326122
327123 // . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
@@ -420,19 +216,5 @@ protected ContributionTab getTab(ContributionType contributionType) {
420216
421217 ContributionTab getActiveTab () {
422218 return (ContributionTab ) tabs .getPanel ();
423- /*
424- switch (tabbedPane.getSelectedIndex()) {
425- case 0:
426- return librariesTab;
427- case 1:
428- return modesTab;
429- case 2:
430- return toolsTab;
431- case 3:
432- return examplesTab;
433- default:
434- return updatesTab;
435- }
436- */
437219 }
438220}
0 commit comments