look-and-feel

Customizing JTextField

微笑、不失礼 提交于 2019-11-30 17:42:01
问题 I would like to know how to customize the ui of a jtextfield so I could create rounded rectangular border without the document going outside the border. So far I think I have tried the most of what I can think of, I have created a new FieldView class and changed the shape in the paint method according to my customized border that draw rounded rects, the only way I sort of managed to get rid of the white textfield document/view was to set it opaque but I think there should be another way

JFrame and Nimbus Look And Feel

别等时光非礼了梦想. 提交于 2019-11-30 15:42:53
I use Nimbus Look and Feel in a project. However, although every GUI JComponent have a Look and Feel of Nimbus, JFrame always have Windows Look and Feel. How can JFrame have Nimbus Look And Feel? Edit: Operating System : Windows XP Marek Sebera Try using this: JFrame.setDefaultLookAndFeelDecorated(true); //before creating JFrames For more info., see How to Set the Look and Feel in the tutorial. import javax.swing.*; class FrameLook { public static void showFrame(String plaf) { try { UIManager.setLookAndFeel(plaf); } catch(Exception e) { e.printStackTrace(); } JFrame f = new JFrame(plaf); f

Can't access synthetica themes on new netbeans 7.4 with latest JDK (1.7.0_45)

眉间皱痕 提交于 2019-11-30 09:43:02
问题 Today i was update my Netbeans 6.8 to new Netbeans 7.4 and JDK 1.7.0 to 1.7.0_45 When i open my previous project on new Netbeans version sysnthetica look and feel is not working :( other everything is working perfectly :) try { UIManager.setLookAndFeel(new SyntheticaBlackStarLookAndFeel()); new frm_login().setVisible(true); } catch (Exception e) { e.printStackTrace(); } this is the error : Exception in thread "main" java.lang.NoClassDefFoundError: sun/swing/plaf/synth/SynthUI at de.javasoft

GUI: How can I find out if certain Unicode characters are supported?

元气小坏坏 提交于 2019-11-30 08:00:50
问题 I noticed that Metal L&F doesn't support certain arrow characters from Unicode, while Nimbus and GTK L&Fs do support them. Unsupported characters are just displayed as: ... Can I either look up (manually), which L&F supports which Unicode chars, or find it out at runtime? EDIT: Or, should it only depend on the L&F's default font, my question perhaps should be: "how do I find out, which Java font supports which Unicode characters?" 回答1: You can use the canDisplay method to test if a java.awt

Nimbus TableHeader was not highlighted as 'pressed'

隐身守侯 提交于 2019-11-30 05:39:23
问题 The JTableHaeder has no 'pressed' highlighting by default. (Nimbus) NimbusDefaults says it has a default [Pressed] background painter. What should I do, to see this when i click on the TableHeader? UPDATE 1 The NimbusStyle.getExtendedState returns the PRESSED on mouseDown correctly. But the NimbusStyle.getBackgroundPainter(SynthContext) returns null cause there is an null in the NimbusStyle.Values cache for the CacheKey "backgroundPainter$$instance" with this state. What is wrong there?

JProgressBar: low values will not be displayed

主宰稳场 提交于 2019-11-29 14:07:59
I tried out the function of the JProgressBar in Java. But there is a problem I couldn't solve: When I set the minimum to zero, the maximum value to 100 and the current value to 6 then nothing will be displayed. The progress bar is empty. If I put 7 as current value then it works. It seems to be a problem with any empty border or other space. The problem occurs with Windows 7 and only if the UIManager is set to SystemLookAndFeel. Does anyone knows this problem and has a solution for this? Below is my code: package lab; import java.awt.FlowLayout; import javax.swing.JDialog; import javax.swing

How to act upon hitting “Enter” when on “Cancel” button in JFileChooser?

旧城冷巷雨未停 提交于 2019-11-29 12:28:06
I have a JFileChooser in a JFrame . I've added an ActionListener to the JFileChooser so that the "Cancel" button works when clicked. I can also tab to the "Cancel" button, but when I then hit the "Enter" key, nothing happens (i.e., the ActionListener isn't called with the event command JFileChooser.CANCEL_SELECTION ). What must I do with the JFileChooser so that hitting the "Enter" key when on the "Cancel" button is equivalent to clicking on the "Cancel" button? Here's a simple example of the (mis)behavior I'm seeing: import java.awt.event.ActionEvent; import java.awt.event.ActionListener;

How do I get the default font for Swing JTabbedPane labels?

微笑、不失礼 提交于 2019-11-29 09:26:37
Does the text in Swing components have a default font? In particular, what about tab labels on JTabbedPane s? I'm working on a mock-up of a GUI made with Swing and want it to blend it with a screen image I grabbed of a Swing app. Reverend Gonzo It depends on the Look and Feel. If it's an application you've written, get the values from UIManager.getDefaults().getFont("TabbedPane.font") The UIManager Defaults shows what the values are for all properties for all components (including "TabbedPane.font"). Based on the answer of Reverend Gonzo, this piece of code lets you know what keys are in the

Good-looking Java Swing Look&Feel?

你说的曾经没有我的故事 提交于 2019-11-29 06:40:45
I'm working on an open-source Java Web Start application, and I'd like to give it a consistent theme across platforms. Metal is totally ugly, and I'm not particularly happy with Substance (esp. performance). What are the best Swing Look&Feel options out there today? I like the 'Nimbus Look&Feel' (2nd image) introduced in Java 6 Update 10 very much and it is contained in SUN's vanilla J2SE of J6u10 and later by default! Another advantage is, that it is painted entirely using Java 2d which makes it fast and rederable at all resolutions. Check out JGoodies , its the de facto standard place to

GUI: How can I find out if certain Unicode characters are supported?

狂风中的少年 提交于 2019-11-29 05:56:35
I noticed that Metal L&F doesn't support certain arrow characters from Unicode, while Nimbus and GTK L&Fs do support them. Unsupported characters are just displayed as: ... Can I either look up (manually), which L&F supports which Unicode chars, or find it out at runtime? EDIT: Or, should it only depend on the L&F's default font, my question perhaps should be: "how do I find out, which Java font supports which Unicode characters?" You can use the canDisplay method to test if a java.awt.Font object can display a given character. You can typically get the font from GUI components using the