比如修改成msn聊天窗口那样,谢谢

解决方案 »

  1.   

    怎么图片显示不了啊,frametitle.bmp (24 KB)
      

  2.   

    每看懂怎么样的,文件的话你直接 frame.setTitle()
      

  3.   

    看看look and feel
    Substance 
    这个项目的目的是提供一个流行的外观(look & feel)。这个外观(look & feel)联合了Windows XP和MacOS 10.4最好的特性并且需要JDK 5.0以上 将下列jar文件拷贝到你的程序的classpath中,然后将下列代码段加入到你main函数中 
    http://l1.edn.cn/cache/http/index.php?q=http%3A%2F%2F210.42.106.102%2Fbbs%2Fviewthread.php%3Ftid%3D111%26amp%3Bextra%3Dpage%253D1 
    (注,其实我在别的文章中给出了一个例子,参见用java打造任意形状窗口一文中的的代码) 
    1.substance look and feel: 
    try { 
    UIManager.setLookAndFeel(new SubstanceLookAndFeel()); 
    UIManager.put("swing.boldMetal", false); 
    if (System.getProperty("substancelaf.useDecorations") == null) { 
    JFrame.setDefaultLookAndFeelDecorated(true); 
    JDialog.setDefaultLookAndFeelDecorated(true); 

    System.setProperty("sun.awt.noerasebackground", "true"); 
    SubstanceLookAndFeel.setCurrentTheme(new SubstanceLightAquaTheme());//设置当前的主题风格,同样我 们还可以设置当前的按钮形状,水印风格等等 
    } catch (Exception e) { 
    System.err.println("Oops! Something went wrong!"); 

    2.smooth look and feel 
    try { 
    UIManager.setLookAndFeel(new SmoothLookAndFeel()); 
    UIManager.put("swing.boldMetal", false); 
    } catch (Exception e) { 
    System.err.println("Oops! Something went wrong!"); 

    3. office/winxp/VisualStudio 2005 look and feel 
    try { 
    UIManager.setLookAndFeel("org.fife.plaf.Office2003.Office2003LookAndFeel"); 
    //UIManager.setLookAndFeel("org.fife.plaf.OfficeXP.OfficeXPLookAndFeel"); 
    //UIManager.setLookAndFeel("org.fife.plaf.VisualStudio2005.VisualStudio2005LookAndFeel"); 
    UIManager.put("swing.boldMetal", false); 
    } catch (Exception e) { 
    System.err.println("Oops! Something went wrong!"); 
    }
      

  4.   

    似乎这种风格的是lookandfeel可以控制,你找找看,我没研究
      

  5.   

    那就要禁用JFrame的本机装饰,
    自己画出来标题栏喽~
    具体怎么实现貌似很麻烦,不会~
      

  6.   

    你看看jdk6中加入的桌面增强api应该有的
      

  7.   


    setUndecorated(true);
    之后,无法显示JMenubar了
      

  8.   

    那个标题栏一般不好修改,无论是msn的还是qq的他们都是把系统自带的标题栏隐藏了,在面板的上面自己加的一个面板写按钮事件.那个就可以自定义出你想要的任何标题栏了.
      

  9.   

    setUndecorated(true); 去掉修饰
    自己生成一个JPanel作为标题栏,在上面添加需要的按钮,实现相关的功能
    为JPanel添加鼠标事件,使其可以移动,可以参考原代码
      

  10.   

    setTitle(""),或
    或者直接在建立framed的时候直接写进去
      

  11.   

    建议看看http://www.open-open.com/61.htm
      

  12.   

    在Control Button处添加你想要得边框,可以正常显示JMenuBarimport java.awt.BorderLayout;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.JPanel;
    import javax.swing.JRootPane;@SuppressWarnings("serial")
    public class TestFrame extends JFrame { public TestFrame() {
    this.setUndecorated(true); JPanel controlPanel = new JPanel();
    JButton closeButton = new JButton("Control Button");
    closeButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    TestFrame.this.dispose();
    }
    });
    controlPanel.add(closeButton);
    JRootPane root = new JRootPane();
    if (rootPane != null) {
    remove(rootPane);
    }
    rootPane = root;
    if (rootPane != null) {
    boolean checkingEnabled = isRootPaneCheckingEnabled();
    try {
    setRootPaneCheckingEnabled(false);
    this.add(controlPanel, BorderLayout.NORTH);
    add(root, BorderLayout.CENTER);
    } finally {
    setRootPaneCheckingEnabled(checkingEnabled);
    }
    }
    } /**
     * @param args
     */
    public static void main(String[] args) {
    TestFrame tf = new TestFrame();
    JMenuBar menuBar2 = new JMenuBar();
    JMenu menu = new JMenu("JMenu");
    menu.add(new JMenuItem("JMenuItem"));
    menuBar2.add(menu);
    tf.setJMenuBar(menuBar2);
    tf.setVisible(true);
    tf.setSize(200, 200);
    tf.setDefaultCloseOperation(EXIT_ON_CLOSE);
    }}