乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      一個漂亮XP風(fēng)格的GUI

       codeman 2006-09-11
      近期發(fā)現(xiàn)一個漂亮的Swing外觀(Substance look & feel ),這個界面的風(fēng)格非常類似于Windows XP界面風(fēng)格,如果你覺得你的Swing界面比較ugly的話,不妨試一試這個(look & feel)外觀。要求JDK為5.0及以上,Substance look & feel下載地址:https://substance.dev./servlets/ProjectDocumentList?folderID=3172&expandFolder=3172&folderID=0。這個項目對中文界面顯示支持不是很好,需要把SubstanceLookAndFeel.java中的字體設(shè)置為宋體等,否則不支持界面中的漢字顯示。
      具體辦法是:
      1.打開源代碼,修改包:org.jvnet.substance下的SubstanceLookAndFeel.java
        中initComponentDefaults()方法中的字體設(shè)置.
      2.把Font tahomaPlain11 = new Font("Tahoma", Font.PLAIN, 11);
        改為Font tahomaPlain11 = new Font("宋體", Font.PLAIN, 11);等.
      3.重新編譯整個工程,然后把SubstanceLookAndFeel.class文件加到substance.jar文件中。

      附圖片:
       
       
      沒有辦法上傳substance.jar文件,因為這文件大于500k.

      一個演示的例子:
      package com.lanyou.swing.basic;

      import java.awt.BorderLayout;
      import java.awt.Color;

      import javax.swing.JColorChooser;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.JDialog;
      import javax.swing.JLabel;
      import javax.swing.JTextField;
      import javax.swing.JButton;
      import javax.swing.UIManager;
      import javax.swing.UnsupportedLookAndFeelException;

      import org.jvnet.substance.SubstanceLookAndFeel;

      /*******************************************************************************
       * 演示顏色對話框的使用
       * 
       * @author Administrator
       * 
       */
      public class ColorDialog extends JDialog {
          private JPanel jContentPane = null;

          private JPanel jPanel = null;

          private JLabel jLabel = null;

          private JTextField jTextField = null;

          private Color color = null;

          private JButton jCloseButton = null;

          /**
           * This method initializes jPanel
           * 
           * @return javax.swing.JPanel
           */
          private JPanel getJPanel() {
              if (jPanel == null) {
                  jLabel = new JLabel();
                  jLabel.setBounds(new java.awt.Rectangle(30, 46, 105, 30));
                  jLabel.setText("選擇對話框顏色:");
                  jPanel = new JPanel();
                  jPanel.setLayout(null);
                  jPanel.add(jLabel, null);
                  jPanel.add(getJTextField(), null);
                  jPanel.add(getJCloseButton(), null);
              }
              return jPanel;
          }

          /**
           * This method initializes jTextField
           * 
           * @return javax.swing.JTextField
           */
          private JTextField getJTextField() {
              if (jTextField == null) {
                  jTextField = new JTextField();
                  jTextField.setBounds(new java.awt.Rectangle(164, 46, 120, 31));
                  jTextField.addMouseListener(new java.awt.event.MouseAdapter() {
                      public void mouseClicked(java.awt.event.MouseEvent e) {
                          color = JColorChooser.showDialog(null, "文本顏色", Color.GREEN);
                          if (color == null)
                              return;
                          ColorDialog.this.jTextField.setBackground(color);
                      }
                  });
              }
              return jTextField;
          }

          /**
           * This method initializes jCloseButton
           * 
           * @return javax.swing.JButton
           */
          private JButton getJCloseButton() {
              if (jCloseButton == null) {
                  jCloseButton = new JButton();
                  jCloseButton.setBounds(new java.awt.Rectangle(107, 92, 80, 36));
                  jCloseButton.setText("關(guān)閉");
                  jCloseButton.addActionListener(new java.awt.event.ActionListener() {
                      public void actionPerformed(java.awt.event.ActionEvent e) {
                          dispose();
                      }
                  });
              }
              return jCloseButton;
          }

          /**
           * @param args
           */
          public static void main(String[] args) {
              // TODO Auto-generated method stub
              ColorDialog dialog = new ColorDialog();
              // dialog.setDefaultCloseOperation(JDialog.EXIT_ON_CLOSE);
              dialog.setVisible(true);
          }

          /**
           * This is the default constructor
           */
          public ColorDialog() {
              super();
              initialize();
          }

          /**
           * This method initializes this
           * 
           * @return void
           */
          private void initialize() {
              try {
                  UIManager.setLookAndFeel(new SubstanceLookAndFeel());
              } catch (UnsupportedLookAndFeelException e) {
                  e.printStackTrace();
              }
              this.setLocation(250, 200);
              this.setSize(326, 173);
              this.setTitle("顏色對話框");
              this.setContentPane(getJContentPane());
          }

          /**
           * This method initializes jContentPane
           * 
           * @return javax.swing.JPanel
           */
          private JPanel getJContentPane() {
              if (jContentPane == null) {
                  jContentPane = new JPanel();
                  jContentPane.setLayout(new BorderLayout());
                  jContentPane.add(getJPanel(), java.awt.BorderLayout.CENTER);
              }
              return jContentPane;
          }

      } // @jve:decl-index=0:visual-constraint="10,10"

        本站是提供個人知識管理的網(wǎng)絡(luò)存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購買等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻(xiàn)花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多