2012-02-11 17 views
1

Javaを使用してMatlab GUIの外観を変更しようとしています。ポストの指示hereを見つけた後、私はこのコードを試してみました:MatlabのNimbusルックアンドフィール

javax.swing.UIManager.setLookAndFeel('com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel'); 

はしかし、結果が正しく表示されていないと私は、次のエラーメッセージを取得しています:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException 
    at com.mathworks.widgets.desk.DTTitleBar$InternalUI.getBottomColor(DTTitleBar.java:1181) 
    at com.mathworks.widgets.desk.DTBorderFactory$DockedFrameBorder.getLineColor(DTBorderFactory.java:370) 
    at com.mathworks.widgets.desk.DTBorderFactory$DockedFrameBorder.paintBorder(DTBorderFactory.java:379) 
    at javax.swing.JComponent.paintBorder(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at javax.swing.JComponent.paintToOffscreen(Unknown Source) 
    at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source) 
    at javax.swing.RepaintManager$PaintManager.paint(Unknown Source) 
    at javax.swing.RepaintManager.paint(Unknown Source) 
    at javax.swing.JComponent._paintImmediately(Unknown Source) 
    at javax.swing.JComponent.paintImmediately(Unknown Source) 
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) 
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) 
    at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source) 
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source) 
    at java.awt.event.InvocationEvent.dispatch(Unknown Source) 
    at java.awt.EventQueue.dispatchEvent(Unknown Source) 
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
    at java.awt.EventDispatchThread.run(Unknown Source) 
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException 
    at com.mathworks.widgets.desk.DTTitleBar$InternalUI.getBottomColor(DTTitleBar.java:1181) 
    at com.mathworks.widgets.desk.DTBorderFactory$DockedFrameBorder.getLineColor(DTBorderFactory.java:370) 
    at com.mathworks.widgets.desk.DTBorderFactory$DockedFrameBorder.paintBorder(DTBorderFactory.java:379) 
    at javax.swing.JComponent.paintBorder(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at javax.swing.JComponent.paintToOffscreen(Unknown Source) 
    at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source) 
    at javax.swing.RepaintManager$PaintManager.paint(Unknown Source) 
    at javax.swing.RepaintManager.paint(Unknown Source) 
    at javax.swing.JComponent._paintImmediately(Unknown Source) 
    at javax.swing.JComponent.paintImmediately(Unknown Source) 
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) 
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) 
    at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source) 
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source) 
    at java.awt.event.InvocationEvent.dispatch(Unknown Source) 
    at java.awt.EventQueue.dispatchEvent(Unknown Source) 
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
    at java.awt.EventDispatchThread.run(Unknown Source) 
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException 
    at com.mathworks.widgets.desk.DTTitleBar$InternalUI.getBottomColor(DTTitleBar.java:1181) 
    at com.mathworks.widgets.desk.DTBorderFactory$DockedFrameBorder.getLineColor(DTBorderFactory.java:370) 
    at com.mathworks.widgets.desk.DTBorderFactory$DockedFrameBorder.paintBorder(DTBorderFactory.java:379) 
    at javax.swing.JComponent.paintBorder(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at javax.swing.JComponent.paintChildren(Unknown Source) 
    at javax.swing.JSplitPane.paintChildren(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at javax.swing.JComponent.paintChildren(Unknown Source) 
    at javax.swing.JSplitPane.paintChildren(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at javax.swing.JComponent.paintChildren(Unknown Source) 
    at javax.swing.JSplitPane.paintChildren(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at javax.swing.JComponent.paintChildren(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at javax.swing.JComponent.paintChildren(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at javax.swing.JComponent.paintChildren(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at javax.swing.JComponent.paintChildren(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at javax.swing.JComponent.paintChildren(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at javax.swing.JLayeredPane.paint(Unknown Source) 
    at javax.swing.JComponent.paintChildren(Unknown Source) 
    at javax.swing.JComponent.paintToOffscreen(Unknown Source) 
    at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source) 
    at javax.swing.RepaintManager$PaintManager.paint(Unknown Source) 
    at javax.swing.RepaintManager.paint(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at java.awt.GraphicsCallback$PaintCallback.run(Unknown Source) 
    at sun.awt.SunGraphicsCallback.runOneComponent(Unknown Source) 
    at sun.awt.SunGraphicsCallback.runComponents(Unknown Source) 
    at java.awt.Container.paint(Unknown Source) 
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) 
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) 
    at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source) 
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source) 
    at java.awt.event.InvocationEvent.dispatch(Unknown Source) 
    at java.awt.EventQueue.dispatchEvent(Unknown Source) 
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
    at java.awt.EventDispatchThread.run(Unknown Source) 
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException 
    at com.mathworks.widgets.desk.DTTitleBar$InternalUI.getBottomColor(DTTitleBar.java:1181) 
    at com.mathworks.widgets.desk.DTBorderFactory$DockedFrameBorder.getLineColor(DTBorderFactory.java:370) 
    at com.mathworks.widgets.desk.DTBorderFactory$DockedFrameBorder.paintBorder(DTBorderFactory.java:379) 
    at javax.swing.JComponent.paintBorder(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at javax.swing.JComponent.paintChildren(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at javax.swing.JComponent.paintChildren(Unknown Source) 
    at javax.swing.JComponent.paint(Unknown Source) 
    at javax.swing.JComponent.paintToOffscreen(Unknown Source) 
    at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source) 
    at javax.swing.RepaintManager$PaintManager.paint(Unknown Source) 
    at javax.swing.RepaintManager.paint(Unknown Source) 
    at javax.swing.JComponent._paintImmediately(Unknown Source) 
    at javax.swing.JComponent.paintImmediately(Unknown Source) 
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) 
    at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source) 
    at javax.swing.RepaintManager.seqPaintDirtyRegions(Unknown Source) 
    at javax.swing.SystemEventQueueUtilities$ComponentWorkRequest.run(Unknown Source) 
    at java.awt.event.InvocationEvent.dispatch(Unknown Source) 
    at java.awt.EventQueue.dispatchEvent(Unknown Source) 
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source) 
    at java.awt.EventDispatchThread.run(Unknown Source) 

私は理解していません何が起こっている。

+0

ほとんどの場合、matlabコンポーネントはルックアンドフィールでのみ動作するように作成されています。 –

+0

ご意見ありがとうございます。しかし、それを行うことは可能です(私が今追加したリンクを参照)。 – julian

+2

Muhammad Abrarが言ったことで判断すると、Matlab GUIが登場する前にLook and Feelを設定することをお勧めします。 Matlabには素敵な初期化スキーマがあり、guiがロードされる前にL&Fを変更するコードを置くだけで、初期化の問題を取り除くことができます。 –

答えて

2

あなたが提供したリンクのコメントセクションを読んでください。引用:

をL & Fを変更すると、 がスローされたJavaの例外を除いて、問題を引き起こしています。デスクトップ全体を変更するには、L & Fはその後、起動設定:

f=com.mathworks.mde.desk.MLDesktop.getInstance.getMainFrame(); 
javax.swing.SwingUtilities.updateComponentTreeUI(f); 

が、私はそれを試してみましたが、ちょうどいくつかの部分が変更され、GUIはかなり使用できなくなります。私はLinux上でMatlab 2010を実行していました。

+0

ありがとうございました。次回は、もっと静かに情報を読んでいきます。 – julian

関連する問題