look-and-feel

About Metro GUI in desktop application

余生长醉 提交于 2019-12-11 15:06:52
问题 I am making a software that will support multiple features simultaneously. I know the logic, and I have developed the features to support. I want my project to have a look similar to Metro GUI of Windows 8. It need not to be specifically Metro, but similar. I know about all the layouts in standard Swing library. Currently I am using GroupLayout though. How should I proceed, any ideas? Because the UI seems dull and I don't want to use 3rd party APIs either. Any suggestions? 回答1: I personally

Swing Nimbus change style of a non editable JTextField

爷,独闯天下 提交于 2019-12-11 11:54:16
问题 Is there a way to change the style of non editable JTextField? We would like to give the TextField a slightly more grayish background if it is set to editable = false. I guess one way would be readonlyComponent.setBackground(Color.LIGHT_GRAY); on every component but this seems error prone and tedious. What I want to achieve is this: Normal JTextFiels should appear as defined by the nimbus look and feel. Readonly fields, e.g. editable = false, should have a different background color. Disabled

Java look and feel at runtime

时间秒杀一切 提交于 2019-12-11 10:36:20
问题 I have a basic GUI (plain Jframe with a button) and I have changed the look and feel using Nimrod. The new l&f is a dark theme which I change at runtime. However, when the GUI is run, for a very brief moment, the GUI has a bright background, and then the new dark l&f is then applied. I assume what is causing this brief flash of brightness is that at runtime, the default l&f is showing briefly, just before the new one is being applied. It's only a fraction of a second, but it's noticeable and

Disabling the shadow around JInternalFrames with the Aqua Look and Feel

拈花ヽ惹草 提交于 2019-12-11 08:52:26
问题 On Mac OS X with the native Aqua Look and Feel, JInternalFrames have a shadow that is part of the frame border. When the internal frame is maximized, the shadow is still visible and takes a lot of space. Is there a way to remove this shadow without switching to another look and feel? 回答1: After digging into the Aqua L&F code in OpenJDK I found an undocumented property that let you change the style of an internal frame. Shadows can be removed with this: internalFrame.putClientProperty(

How to change dynamically the icons when the look and feel change?

江枫思渺然 提交于 2019-12-11 07:50:10
问题 I'm developing a look-and-feel with two themes. The problem is: I want to be able to switch dynamically between the two themes (it means changing the themes after startup). But the themes have two different sets of icons (in fact the same icons with different colors). I don't know how to change dynamically the icons in the entire application. One solution would be to register each component with an icon and the icon ID on an icon manager to switch between the two kinds of icons, but it seems

Nimbus look and feel for Matlab

半城伤御伤魂 提交于 2019-12-11 07:36:57
问题 I am trying to change the appearance of my Matlab GUI using Java. Following the instructions of the post found here, I have tried this code: javax.swing.UIManager.setLookAndFeel('com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel'); However, the results are not shown correctly and I am getting the following error messages: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at com.mathworks.widgets.desk.DTTitleBar$InternalUI.getBottomColor(DTTitleBar.java:1181) at com

How to set a default preferred size (redefining UI) in a *ComponentUI class (Swing app)?

匆匆过客 提交于 2019-12-11 07:33:42
问题 I extended the system look and feel to draw custom JButton . UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.put("ButtonUI", "com.my.package.MyButtonUI"); With com.my.package.MyButtonUI : public class MyButtonUI extends BasicButtonUI { public static final int BTN_HEIGHT = 24; private static final MyButtonUI INSTANCE = new MyButtonUI (); public static ComponentUI createUI(JComponent b) { return INSTANCE; } @Override public void paint(Graphics g, JComponent c) {

Customized JTable look

前提是你 提交于 2019-12-11 05:08:46
问题 I want to create a JTable with few columns which has JButtons on it. I can create JCheckBoxes and also JComboBoxes in the JTable cells but not the JButtons. How do i do this ? 回答1: In my project, this is how I did it for a 4-row table with 3 columns where the first column has JToggleButton in every row: The necessary objects... private JTable table1; private DefaultTableModel table1Model; private JScrollPane scrollPane1; String[] columnName = {"Button", "Boolean", "Int" }; and under the code

How to change swing applicaiton's look and feel at runtime?

时间秒杀一切 提交于 2019-12-11 03:46:07
问题 I know that there's a SwingUtilities.updateComponentTreeUI(Component c) method but it doesn't work perfectly. For example, I have a JFileChooser and the current look and feel is Windows, then I change the look and feel to Nimbus with SwingUtilities.updateComponentTreeUI(mainWindow) , and the main window's style is changed correctly, but when I show the file chooser with the JFileChooser.showOpenDialog(Component parent) method, it's still in Windows look and feel. The same happens if I show a

jSeparator looks - Preview Design vs Run File (netbeans)

北城余情 提交于 2019-12-11 02:58:36
问题 I have this little problem. I'm using Netbeans. When I click on Preview Design I see the jSeparators like this: But when I run the project this is what it looks like: How can I fix this problem? I want the project to look like the Preview Design. Thanks! 回答1: When you run your window ( JFrame , JDialog ) / component ( JPanel ) in Preview Design it's displayed using system look and feel, but when you run your application UIManager uses a cross-platform L&F by default, also called Metal L&F. I