2012-06-22 2 views
1

내 run.bat를 :새로운 pushingpixal 테마를 추가,하지만 변화

@echo off 
@title test 
java -Dfile.encoding=Cp1252 -classpath bin;lib/libs.jar;lib/substance-6.0.jar;lib/trident-1.2.jar; Loader 
pause 

내 프레임 :

void openFrame() { 
     try { 
     UIManager.setLookAndFeel("org.pushingpixals.substance.api.skin.SubstanceTwilightLookAndFeel"); 
      JFrame.setDefaultLookAndFeelDecorated(true); 
      JDialog.setDefaultLookAndFeelDecorated(true); 
     } catch (Throwable e) { 
      e.getStackTrace(); 
     } 
       appletFrame = new JFrame(Settings.serverName); 
       appletFrame.setLayout(new BorderLayout()); 
    appletFrame.setDefaultCloseOperation(3); 
    appletPanel.setLayout(new BorderLayout()); 
    appletPanel.add(this); 
    appletPanel.setPreferredSize(new Dimension(765, 504)); 
    appletFrame.getContentPane().add(appletPanel, "Center"); 
    appletFrame.pack(); 
    appletFrame.setLocationRelativeTo(null); 
    appletFrame.setVisible(true); 

나는 이런 짓을하지 않습니다하지만 어떤 이유로 테마 나던 변화. 무슨 문제가있는 것 같습니까? 나는 정확한 물질과 삼지창을 가지고 있지만 아직 변하지 않습니다.

Substance L&F에 대한 1.change이 그림 것 invokeLater()

public static void main(String[] args) { 
    SwingUtilities.invokeLater(new Runnable() { 

     @Override 
     public void run() { 
      JFrame.setDefaultLookAndFeelDecorated(true); 
      JDialog.setDefaultLookAndFeelDecorated(true); 
      try { 
       UIManager.setLookAndFeel(new org.pushingpixels.substance.api.skin.SubstanceBusinessBlackSteelLookAndFeel()); 
      } catch (UnsupportedLookAndFeelException ex) { 
      } 
      // rest of your code 
     } 
    }); 
} 

2.better에 랩해야

+0

정확하게 'appletFrame'이 무엇을 의미합니까? 불쾌한 용어를 사용하지 마십시오. JApplet 또는 JFrame 일 수 있지만 둘 다 사용할 수는 없습니다 : –

+1

'pushingpixals'는 오타입니까? – lhballoti

+0

@lhballoti : 좋지 않은 경우 :-) –

답변

1

, 이름

(SubstanceLookAndFeel.setSkin(new BusinessBlueSteelSkin());)

또는

에 의해 피부를 호출

(UIManager.setLookAndFeel(new org.pushingpixels.substance.api.skin.SubstanceBusinessBlackSteelLookAndFeel());)

코드 예제 by Kirill

import java.awt.BorderLayout; 
import java.awt.FlowLayout; 
import java.awt.event.ActionEvent; 
import java.awt.event.ActionListener; 
import javax.swing.*; 
import org.pushingpixels.substance.api.DecorationAreaType; 
import org.pushingpixels.substance.api.SubstanceLookAndFeel; 
import org.pushingpixels.substance.api.skin.BusinessBlueSteelSkin; 

/** 
* Test application that shows the use of the 
* {@link SubstanceLookAndFeel#getDecorationType(java.awt.Component)} API called 
* on different components. 
* 
* @author Kirill Grouchnikov 
* @see SubstanceLookAndFeel#getDecorationType(java.awt.Component) 
*/ 
public class GetDecorationType extends JFrame { 

    private static final long serialVersionUID = 1L; 

    /** 
    * Creates the main frame for <code>this</code> sample. 
    */ 
    public GetDecorationType() { 
     super("Get decoration type"); 
     this.setLayout(new BorderLayout()); 
     final JTabbedPane tabs = new JTabbedPane(); 
     SubstanceLookAndFeel.setDecorationType(tabs, DecorationAreaType.HEADER); 
     JPanel tab1 = new JPanel(new FlowLayout()); 
     tab1.add(new JTextField("sample")); 
     final JComboBox combo = new JComboBox(new Object[]{"sample"}); 
     tab1.add(combo); 
     SubstanceLookAndFeel.setDecorationType(tab1, DecorationAreaType.GENERAL); 
     JPanel tab2 = new JPanel(new FlowLayout()); 
     tab2.add(new JTextField("sample2")); 
     tab2.add(new JComboBox(new Object[]{"sample2"})); 
     SubstanceLookAndFeel.setDecorationType(tab2, DecorationAreaType.GENERAL); 
     tabs.addTab("tab1", tab1); 
     tabs.addTab("tab2", tab2); 
     this.add(tabs, BorderLayout.CENTER); 
     JPanel controlPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT)); 
     JButton getTypes = new JButton("Get types"); 
     getTypes.addActionListener(new ActionListener() { 

      @Override 
      public void actionPerformed(ActionEvent e) { 
       SwingUtilities.invokeLater(new Runnable() { 

        @Override 
        public void run() { 
         DecorationAreaType tabsType = SubstanceLookAndFeel.getDecorationType(tabs); 
         DecorationAreaType comboType = SubstanceLookAndFeel.getDecorationType(combo); 
         JOptionPane.showMessageDialog(GetDecorationType.this, 
           "Tabbed pane: " + tabsType.getDisplayName() + "\n" + "Combo box: " + comboType.getDisplayName()); 
        } 
       }); 
      } 
     }); 
     controlPanel.add(getTypes); 
     this.add(controlPanel, BorderLayout.SOUTH); 
     this.setSize(400, 200); 
     this.setLocationRelativeTo(null); 
     this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
    } 

    /** 
    * The main method for <code>this</code> sample. The arguments are ignored. 
    * 
    * @param args 
    *   Ignored. 
    */ 
    public static void main(String[] args) { 
     JFrame.setDefaultLookAndFeelDecorated(true); 
     JDialog.setDefaultLookAndFeelDecorated(true); 
     SwingUtilities.invokeLater(new Runnable() { 

      public void run() { 
       SubstanceLookAndFeel.setSkin(new BusinessBlueSteelSkin()); 
       UIManager.put("TabbedPane.contentOpaque", Boolean.TRUE); 
       new GetDecorationType().setVisible(true); 
      } 
     }); 
    } 
} 
+0

+!, 좋은 작업 예제. 물질 LookAndFeel은 진짜 좋은 :-) –

+0

고마워,하지만 그것은 작동하지 않았다 : /, 나는 물질의 모양과 느낌의 이전 버전을 시도하고 내가 당신에게 보여준 코드와 함께 일했다. 물질의 룩앤필의 오래된 버전은 정말 추악한 주제이지만, 푸싱의 물질은 멋진 멋진 테마를 가지고 있습니다. 그 사람들은 나를 위해 일하는 것 같지 않습니다. – 0x29A

+0

eerrrghtt [당신은 무엇에 대해 말하고 있었습니까] (http://stackoverflow.com/a/10909869/714968) – mKorbel