标签: look-and-feel

mac在其他平台上看起来感觉如何?

我只是好奇是否有一个gui框架可以合并你在其他平台上使用mac外观.可能使用本机API的框架没有用处(例如wxwidgets).qt部分使用本机API来实现mac look n,因此无用.摇摆怎么样?

macos cross-platform look-and-feel

3
推荐指数
1
解决办法
473
查看次数

如何列出所有可用的LookAndFeel主题?

如何列出所有可用的LookAndFeel主题?我想在JComboBox中显示供用户选择.

java swing look-and-feel

3
推荐指数
2
解决办法
5881
查看次数

Seaglass的外观和感觉

我写了一个简单的测试类来测试seaglass外观和感觉的功能http://seaglass.googlecode.com/ 我得到了'nimbus class not found'的例外.

import java.awt.*; 
import javax.swing.*; 


 public class asd {

    private static void createWindow() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {

       //Create and set up the window. 
       JFrame frame = new JFrame("Simple GUI");
       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 

       JLabel textLabel = new JLabel("I'm a label in the window",SwingConstants.CENTER); 
       textLabel.setPreferredSize(new Dimension(300, 100)); 
       frame.getContentPane().add(textLabel, BorderLayout.CENTER); 

       //Display the window. 
       frame.setLocationRelativeTo(null); 
       frame.pack();
       frame.setVisible(true);
               }

    public static void main(String[] args) {
             try {
                UIManager.setLookAndFeel("com.seaglasslookandfeel.SeaGlassLookAndFeel");
                createWindow();
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace(); …
Run Code Online (Sandbox Code Playgroud)

java swing look-and-feel nimbus

3
推荐指数
1
解决办法
7404
查看次数

JTable TableCellRenderer背景带有NimbusLookAndFeel颜色问题

我正在使用NimbusLookAndFeel.有了这种外观和感觉JTable的单元格背景是白色和浅灰色(它取决于行号).现在,我正在编写一些实现TableCellRenderer的自定义单元格渲染器.我需要根据JTable中单元格的位置设置这些渲染器的背景.

public class MyCellRenderer extends JLabel implements TableCellRenderer{


    @Override
    public Component getTableCellRendererComponent(JTable table, Object value,
            boolean isSelected, boolean hasFocus, int row, int column) {

                Color bgColor = //need to retrieve the right cell background color
                setBackground(bgColor);
        return this;
    }

}
Run Code Online (Sandbox Code Playgroud)

我怎样才能获得这样的Color值?

swing jtable look-and-feel nimbus tablecellrenderer

3
推荐指数
1
解决办法
8154
查看次数

为所有JComponents设置默认设置的简便方法是什么

我想要一种方法来设置我在GUI中使用的所有组件的默认设置,如背景颜色,大小等,这是一种方便的方法吗?所以当我做新的JButton或JLabel等时,它已经应用了设置?

java swing jcomponent look-and-feel uimanager

3
推荐指数
1
解决办法
253
查看次数

JMenu不在Windows的外观和感觉

嗨,我有一个带菜单的Swing应用程序.创建包含menues文本的前两个属性,然后将lookandfeel设置为windows,最后填充menues.这是源代码:

private JMenu[] Menue={new JMenu("File")};

private JMenuItem[][] MenuItemsString ={{new JMenuItem("Import"),new JMenuItem("Export")}};
...
public window(){
       super ("Q3MeshConverter");

       plate = new JPanel(new BorderLayout());
       try{
           UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");// set Windows lookandfeel
           }
           catch(Exception x){

           }
       menuBar = new JMenuBar();
       ...
       setJMenuBar(menuBar);

       JMenu[] Menu =Menue;
       JMenuItem[][] MenuItems =MenuItemsString;
       for(int m=0;m<Menu.length;m++){// loop trough the Menu(es)
           menuBar.add(Menu[m]);
           for(int mi=0;mi<MenuItems[m].length;mi++){// loop through the MenuItems
               Menu[m].add(MenuItems[m][mi]);
               MenuItems[m][mi].addActionListener(this);
           }
       }
       ...   
       setContentPane (plate);
}
Run Code Online (Sandbox Code Playgroud)

那是丑陋的输出:

它为什么会这样?

java swing look-and-feel

3
推荐指数
1
解决办法
2329
查看次数

需要Jbuttons透明外观

我正在使用Java Netbeans GUI Builder来制作GUI.我想给按钮一个透明(有光泽)的外观.我正在使用

UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Run Code Online (Sandbox Code Playgroud)

这也给了GUI很好的外观,但按钮仍然是相同的无聊按钮.

那么,如何给按钮一个透明的外观呢?

java swing transparency netbeans look-and-feel

3
推荐指数
1
解决办法
6963
查看次数

JFrame使用Windows边框进行装饰,否则即使设置了外观也感觉不到

今天是个好日子.

首先:检查此图像.

请注意,在3个框架的第一个框架中,按钮采用金属外观设计,但框架采用Windows风格.在按钮LAF与帧LAF匹配的情况下,其他2帧是"OK".

所有这些的代码(与图像的顺序相同):

public static void main(String[] args) {

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {             
            JFrame frame = new JFrame();

            frame.getContentPane().add(new JButton("button"));
            frame.setVisible(true);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        }
    });
}

public static void main(String[] args) {

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {             
            JFrame frame = new JFrame();

            frame.setUndecorated(true);
            frame.getRootPane().setWindowDecorationStyle(JRootPane.FRAME);
            frame.setSize(100, 100); 

            frame.getContentPane().add(new JButton("button"));
            frame.setVisible(true);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        }
    });
}

public static void main(String[] args) {

    SwingUtilities.invokeLater(new Runnable() {
        @Override
        public void run() {
            try {
                // 0 => "javax.swing.plaf.metal.MetalLookAndFeel" …
Run Code Online (Sandbox Code Playgroud)

java swing jframe look-and-feel

3
推荐指数
1
解决办法
1万
查看次数

改变特定窗口的外观

我正在为更大的GUI应用程序编写脚本.主应用程序窗口使用系统LookAndFeel,但我希望我的脚本的GUI使用Nimbus LookAndFeel.创建GUI后,我想将其设置LookAndFeel回原始版本.我觉得下面的SSCCE应该可以工作,但我NullPointerException在使用我的Component对象时会得到一个.

import java.awt.Dimension;
import java.awt.GridBagLayout;
import javax.swing.*;
import javax.swing.UIManager.LookAndFeelInfo;

public class GUI extends JFrame {
    private static LookAndFeel originalLookAndFeel = UIManager.getLookAndFeel();
    static {
        System.out.println("At start, look and feel is " + UIManager.getLookAndFeel().getName());
        try {
            setNimbusLookAndFeel();
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        System.out.println("Look and feel changed to " + UIManager.getLookAndFeel().getName()
                + " before component creation");
    }
    private GridBagLayout gridBag = new GridBagLayout();
    private JTabbedPane tabs = new JTabbedPane(); …
Run Code Online (Sandbox Code Playgroud)

java swing nullpointerexception look-and-feel

3
推荐指数
1
解决办法
2234
查看次数

如何制作一个摇摆应用程序有黑暗的灵气主题netbeans

所以我不熟悉Netbeans和Swing GUI开发,我试图改变JFrame的外观.当我创建一个JFrame窗体时,Netbeans默认使它成为Nimbus主题.

我尝试更改为Windows主题(if ("Windows".equals(info.getName())) {)和Metal主题(if ("Metal".equals(info.getName())) {),它与这两个主题完美配合.

但是,当我尝试将其更改为Dark Nimbus主题(if ("Dark Nimbus".equals(info.getName())) {)时,它无法正常工作.

我也尝试过右键单击>预览设计> Dark Nimbus,是的,它按预期预览了Dark Nimbus主题.但是当我实际编译并运行程序时(通过单击播放按钮).

有谁知道如何将主题改为"Dark Nimbus"?

这是相关代码:

    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
    /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
     * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
     */
    try {
        for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
            if ("Dark Nimbus".equals(info.getName())) {
                javax.swing.UIManager.setLookAndFeel(info.getClassName()); …
Run Code Online (Sandbox Code Playgroud)

java swing netbeans look-and-feel

3
推荐指数
1
解决办法
4555
查看次数