look-and-feel

Please recommend pretty Java Swing components library [closed]

半城伤御伤魂 提交于 2019-11-27 05:02:05
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I am right now working on a job of retouching the user interface of a software which is coded in Java. The interface is now built using Swing. I am looking for a library of Java Swing components, which should look better than the original JComponent s. I have already found SlickerBox; the components there look

Change background and text color of JMenuBar and JMenu objects inside it

雨燕双飞 提交于 2019-11-27 04:44:27
问题 How can I set custom background color for JMenuBar and JMenu objects inside it? I tried .setBackgroundColor and it does not work! 回答1: Create a new class that extends JMenuBar : public class BackgroundMenuBar extends JMenuBar { Color bgColor=Color.WHITE; public void setColor(Color color) { bgColor=color; } @Override protected void paintComponent(Graphics g) { super.paintComponent(g); Graphics2D g2d = (Graphics2D) g; g2d.setColor(bgColor); g2d.fillRect(0, 0, getWidth() - 1, getHeight() - 1); }

jcombobox filter in java - Look and feel independent

久未见 提交于 2019-11-27 04:40:06
I have a simple JComboBox filter code like this : import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.List; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.UIManager; public class FilterComboBox extends JComboBox { private List<String> array; public FilterComboBox(List<String> array) { super(array.toArray()); this.array = array; this.setEditable(true); final JTextField textfield = (JTextField) this

Trying to create JTable with proper row header

大城市里の小女人 提交于 2019-11-27 04:39:38
I am trying to create a JTable that has a row header that looks just like a column header and I have spent altogether too much time on it :/ My situation is similar to this question: JTable Row Header Implementation and maybe this one: customizing jtable cellrenderer with table's cell header color They don't seem to have gotten me all the way there yet. I have searched tried many examples out there and all are lacking. There aren't even any examples of tables with row headers at all from Oracle/Sun. It seems like this kind of table shouldn't be that rare. This one just formats the first column

jcombobox filter in java - Look and feel independent

狂风中的少年 提交于 2019-11-27 03:58:18
问题 I have a simple JComboBox filter code like this : import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.List; import javax.swing.DefaultComboBoxModel; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JTextField; import javax.swing.SwingUtilities; import javax.swing.UIManager; public class FilterComboBox extends JComboBox { private List<String> array; public FilterComboBox(List<String> array) { super(array

Can't change JProgressBar color in Mac OS look and feel

耗尽温柔 提交于 2019-11-26 23:39:11
问题 I know this question has been answered before, but it's just not working for me. I followed the instructions from here: How to change JProgressBar color? import javax.swing.*; import java.awt.*; public class ProgressBarTest extends JFrame { public static void main(String args[]) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); UIManager.put("ProgressBar.background", Color.orange); UIManager.put("ProgressBar.foreground", Color.black); UIManager.put("ProgressBar

Changing look and feel of specific window

我们两清 提交于 2019-11-26 22:08:07
问题 I'm writing a script for a larger GUI application. The main application window uses the system's LookAndFeel , but I want my script's GUI to use the Nimbus LookAndFeel . After GUI creation, I want to set the LookAndFeel back to the original. I feel the below SSCCE should work, but I'm getting a NullPointerException when using my Component objects. import java.awt.Dimension; import java.awt.GridBagLayout; import javax.swing.*; import javax.swing.UIManager.LookAndFeelInfo; public class GUI

How can I make a java FileDialog accept directories as its FileType in OS X?

守給你的承諾、 提交于 2019-11-26 22:02:09
问题 I am trying to switch from using a JFileChooser to a FileDialog when my app is being run on a mac so that it will use the OS X file chooser. So far I have the following code: FileDialog fd = new FileDialog(this); fd.setDirectory(_projectsBaseDir.getPath()); fd.setLocation(50,50); fd.setFile(?); fd.setVisible(true); File selectedFile = new File(fd.getFile()); What would I put in for the question ? so that my file chooser would allow any directory to be the input for file chooser (the method

Can we ape the GTK+ 2.0 button style in Java Swing?

ぃ、小莉子 提交于 2019-11-26 18:36:47
问题 The problem with Java Swing is the look and feels (Metal, Nimbus, GTK...), the worst out there compared to SWT, Windows, Mac and Gnome Tool Kit, and getting good looking widgets is utopist, yet I am asking the question though. I need to know if there is a possibility to tweak a JButton to look like a default GTK button. Otherwise, can we give the JButton text a style (a shadow for example)? public class myTweakedButton extends JButton { // Override style attributes here. } Here is the style

How can I change the arrow style in a JComboBox

隐身守侯 提交于 2019-11-26 17:50:18
Let's say I want to use a custom image for the arrow in JComboBox, how can I do this? I understand it's possible using the synth xml files, or maybe even UIManager.put(...), but I don't know how. All I want to do at this time is change the arrow image to something else, either programatically or even just overriding the image it uses. How exactly can I do this? You can override createArrowButton() in BasicComboBoxUI . BasicArrowButton is a convenient starting point. class ColorArrowUI extends BasicComboBoxUI { public static ComboBoxUI createUI(JComponent c) { return new ColorArrowUI(); }