Browse Source

fixes(?) issue 1324: Tabbed DIalogs have odd colour

git-svn-id: http://svn.dmdirc.com/trunk@4181 00569f92-eb28-0410-84fd-f71c24880f
tags/0.6
Gregory Holmes 16 years ago
parent
commit
bf2adef57b

+ 67
- 23
src/com/dmdirc/ui/swing/MainFrame.java View File

@@ -19,6 +19,7 @@
19 19
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 20
  * SOFTWARE.
21 21
  */
22
+
22 23
 package com.dmdirc.ui.swing;
23 24
 
24 25
 import com.dmdirc.FrameContainer;
@@ -119,7 +120,7 @@ public final class MainFrame extends JFrame implements WindowListener,
119 120
      */
120 121
     protected MainFrame(final SwingStatusBar statusBar) {
121 122
         super();
122
-        
123
+
123 124
         this.statusBar = statusBar;
124 125
 
125 126
         initComponents();
@@ -154,6 +155,8 @@ public final class MainFrame extends JFrame implements WindowListener,
154 155
         showVersion =
155 156
                 IdentityManager.getGlobalConfig().
156 157
                 getOptionBool("ui", "showversion", false);
158
+        IdentityManager.getGlobalConfig().
159
+                addChangeListener("ui", "lookandfeel", this);
157 160
         IdentityManager.getGlobalConfig().
158 161
                 addChangeListener("ui", "showversion", this);
159 162
         IdentityManager.getGlobalConfig().
@@ -165,7 +168,7 @@ public final class MainFrame extends JFrame implements WindowListener,
165 168
             /** {@inheritDoc} */
166 169
             @Override
167 170
             public void windowGainedFocus(WindowEvent e) {
168
-                //Ignore
171
+            //Ignore
169 172
             }
170 173
 
171 174
             /** {@inheritDoc} */
@@ -174,7 +177,7 @@ public final class MainFrame extends JFrame implements WindowListener,
174 177
                 MenuSelectionManager.defaultManager().clearSelectedPath();
175 178
             }
176 179
         });
177
-        
180
+
178 181
         setTitle(getTitlePrefix());
179 182
     }
180 183
 
@@ -297,46 +300,74 @@ public final class MainFrame extends JFrame implements WindowListener,
297 300
         return statusBar;
298 301
     }
299 302
 
300
-    /** {@inheritDoc}. */
303
+    /** 
304
+     * {@inheritDoc}.
305
+     * 
306
+     * @param windowEvent Window event
307
+     */
301 308
     @Override
302 309
     public void windowOpened(final WindowEvent windowEvent) {
303
-        //ignore
310
+    //ignore
304 311
     }
305 312
 
306
-    /** {@inheritDoc} */
313
+    /** 
314
+     * {@inheritDoc}.
315
+     * 
316
+     * @param windowEvent Window event
317
+     */
307 318
     @Override
308 319
     public void windowClosing(final WindowEvent windowEvent) {
309 320
         quit();
310 321
     }
311 322
 
312
-    /** {@inheritDoc}. */
323
+    /** 
324
+     * {@inheritDoc}.
325
+     * 
326
+     * @param windowEvent Window event
327
+     */
313 328
     @Override
314 329
     public void windowClosed(final WindowEvent windowEvent) {
315
-        //ignore
330
+    //ignore
316 331
     }
317 332
 
318
-    /** {@inheritDoc}. */
333
+    /** 
334
+     * {@inheritDoc}.
335
+     * 
336
+     * @param windowEvent Window event
337
+     */
319 338
     @Override
320 339
     public void windowIconified(final WindowEvent windowEvent) {
321 340
         ActionManager.processEvent(CoreActionType.CLIENT_MINIMISED, null);
322 341
     }
323 342
 
324
-    /** {@inheritDoc}. */
343
+    /** 
344
+     * {@inheritDoc}.
345
+     * 
346
+     * @param windowEvent Window event
347
+     */
325 348
     @Override
326 349
     public void windowDeiconified(final WindowEvent windowEvent) {
327 350
         ActionManager.processEvent(CoreActionType.CLIENT_UNMINIMISED, null);
328 351
     }
329 352
 
330
-    /** {@inheritDoc}. */
353
+    /** 
354
+     * {@inheritDoc}.
355
+     * 
356
+     * @param windowEvent Window event
357
+     */
331 358
     @Override
332 359
     public void windowActivated(final WindowEvent windowEvent) {
333
-        //ignore
360
+    //ignore
334 361
     }
335 362
 
336
-    /** {@inheritDoc}. */
363
+    /** 
364
+     * {@inheritDoc}.
365
+     * 
366
+     * @param windowEvent Window event
367
+     */
337 368
     @Override
338 369
     public void windowDeactivated(final WindowEvent windowEvent) {
339
-        //ignore
370
+    //ignore
340 371
     }
341 372
 
342 373
     /** Initialiases the frame managers. */
@@ -382,7 +413,8 @@ public final class MainFrame extends JFrame implements WindowListener,
382 413
 
383 414
         getContentPane().setLayout(new MigLayout("fill, ins rel, wrap 1, hidemode 2"));
384 415
         getContentPane().add(mainSplitPane, "grow, push");
385
-        getContentPane().add(statusBar, "hmax 20, wmax 100%-2*rel, wmin 100%-2*rel");
416
+        getContentPane().add(statusBar,
417
+                "hmax 20, wmax 100%-2*rel, wmin 100%-2*rel");
386 418
 
387 419
         setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
388 420
 
@@ -400,7 +432,8 @@ public final class MainFrame extends JFrame implements WindowListener,
400 432
     private void initSplitPane(final JSplitPane mainSplitPane) {
401 433
         mainSplitPane.setBorder(null);
402 434
 
403
-        mainSplitPane.setDividerSize((int) PlatformDefaults.getPanelInsets(0).getValue());
435
+        mainSplitPane.setDividerSize((int) PlatformDefaults.getPanelInsets(0).
436
+                getValue());
404 437
         mainSplitPane.setOneTouchExpandable(false);
405 438
 
406 439
         position =
@@ -572,7 +605,11 @@ public final class MainFrame extends JFrame implements WindowListener,
572 605
         return super.isVisible();
573 606
     }
574 607
 
575
-    /** {@inheritDoc}. */
608
+    /** 
609
+     * {@inheritDoc}.
610
+     * 
611
+     * @param newTitle New Title
612
+     */
576 613
     @Override
577 614
     public void setTitle(final String newTitle) {
578 615
         //NOPMD
@@ -583,9 +620,14 @@ public final class MainFrame extends JFrame implements WindowListener,
583 620
     @Override
584 621
     public void configChanged(final String domain, final String key) {
585 622
         if ("ui".equals(domain)) {
586
-            showVersion =
587
-                    IdentityManager.getGlobalConfig().
588
-                    getOptionBool("ui", "showversion", false);
623
+            if ("lookandfeel".equals(key))  {
624
+                //Almost there
625
+                //SwingController.updateLookAndFeel();
626
+            } else {
627
+                showVersion =
628
+                        IdentityManager.getGlobalConfig().
629
+                        getOptionBool("ui", "showversion", false);
630
+            }
589 631
         } else {
590 632
             imageIcon =
591 633
                     new ImageIcon(IconManager.getIconManager().getImage("icon"));
@@ -596,7 +638,7 @@ public final class MainFrame extends JFrame implements WindowListener,
596 638
     /** {@inheritDoc}. */
597 639
     @Override
598 640
     public void setParent(final JComponent parent) {
599
-        //Ignore
641
+    //Ignore
600 642
     }
601 643
 
602 644
     /** {@inheritDoc}. */
@@ -658,13 +700,15 @@ public final class MainFrame extends JFrame implements WindowListener,
658 700
 
659 701
     /** {@inheritDoc}. */
660 702
     @Override
661
-    public void addWindow(final FrameContainer parent, final FrameContainer window) {
703
+    public void addWindow(final FrameContainer parent,
704
+            final FrameContainer window) {
662 705
         addWindow(window);
663 706
     }
664 707
 
665 708
     /** {@inheritDoc}. */
666 709
     @Override
667
-    public void delWindow(final FrameContainer parent, final FrameContainer window) {
710
+    public void delWindow(final FrameContainer parent,
711
+            final FrameContainer window) {
668 712
         delWindow(window);
669 713
     }
670 714
 }

+ 25
- 1
src/com/dmdirc/ui/swing/SwingController.java View File

@@ -24,6 +24,7 @@ package com.dmdirc.ui.swing;
24 24
 
25 25
 import com.dmdirc.Channel;
26 26
 import com.dmdirc.FrameContainer;
27
+import com.dmdirc.Main;
27 28
 import com.dmdirc.ui.IconManager;
28 29
 import com.dmdirc.Query;
29 30
 import com.dmdirc.Server;
@@ -56,8 +57,8 @@ import java.awt.Toolkit;
56 57
 import java.lang.reflect.InvocationTargetException;
57 58
 import java.net.URI;
58 59
 import java.util.List;
59
-
60 60
 import java.util.concurrent.Semaphore;
61
+
61 62
 import javax.swing.JOptionPane;
62 63
 import javax.swing.SwingUtilities;
63 64
 import javax.swing.UIManager;
@@ -313,6 +314,29 @@ public final class SwingController implements UIController {
313 314
         });
314 315
     }
315 316
 
317
+    /**
318
+     * Updates the look and feel to the current config setting.
319
+     */
320
+    static void updateLookAndFeel() {
321
+        try {
322
+            UIManager.setLookAndFeel(UIUtilities.getLookAndFeel(IdentityManager.getGlobalConfig().
323
+                    getOption("ui", "lookandfeel", "")));
324
+            SwingUtilities.updateComponentTreeUI((MainFrame) Main.getUI().getMainWindow());
325
+        } catch (ClassNotFoundException ex) {
326
+            Logger.userError(ErrorLevel.LOW,
327
+                    "Unable to change Look and Feel: " + ex.getMessage());
328
+        } catch (InstantiationException ex) {
329
+            Logger.userError(ErrorLevel.LOW,
330
+                    "Unable to change Look and Feel: " + ex.getMessage());
331
+        } catch (IllegalAccessException ex) {
332
+            Logger.userError(ErrorLevel.LOW,
333
+                    "Unable to change Look and Feel: " + ex.getMessage());
334
+        } catch (UnsupportedLookAndFeelException ex) {
335
+            Logger.userError(ErrorLevel.LOW,
336
+                    "Unable to change Look and Feel: " + ex.getMessage());
337
+        }
338
+    }
339
+
316 340
     /** {@inheritDoc} */
317 341
     @Override
318 342
     public void initUISettings() {

+ 1
- 0
src/com/dmdirc/ui/swing/UIUtilities.java View File

@@ -113,6 +113,7 @@ public final class UIUtilities {
113 113
         
114 114
         UIManager.put("swing.useSystemFontSettings", true);
115 115
         
116
+        UIManager.put("TabbedPane.contentOpaque", false);
116 117
         UIManager.put("swing.boldMetal", false);
117 118
         UIManager.put("InternalFrame.useTaskBar", false);
118 119
         UIManager.put("SplitPaneDivider.border", BorderFactory.createEmptyBorder());

Loading…
Cancel
Save