nimbus

JButton background on Nimbus LAF

£可爱£侵袭症+ 提交于 2019-12-17 16:55:12
问题 I use Nimbus LAF and I want to change the background of a simple JButton . JButton jbutton = new JButton("test"); jbutton.setBackground(Color.BLACK); But it doesn't work, when I change the look and feel it works but it doesn't work in Nimbus. How can i do it? Thanks for your help. 回答1: Nimbus uses Painter to paint the different Styles. By Default the Button has a gradient not a single Color. See Button: Nimbus Defaults List You can write your own Painter and override the default. Or you

Custom swing JTextComponent [closed]

孤人 提交于 2019-12-13 22:28:01
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I want to create a JTextArea which looks like JTextArea, acts like JTextArea, responds like JTextArea, speaks like JTextArea, moves like JTextArea, etc, but is not JTextArea. To make it short, I'd like to create

Nimbus JTextArea default border

▼魔方 西西 提交于 2019-12-13 05:58:26
问题 So, I have a JTextArea in my program which uses Nimbus LAF. I need to swap it for JTextPane because of some functionality issues. However, JTextArea has a painted border by default. JTextPane does not. I do not know which is the JTextArea's default border to set it to JTextPane. I tried with getBorder(), but that only returned "javax.swing.plaf.synth.SynthBorder@455e3f91" How do I get default JTextBoreder to JTextPane? 回答1: I guess you are looking for this: UIManager.getDefaults().getBorder(

Specifying a frame icon on Scala’s Swing Frame

六月ゝ 毕业季﹏ 提交于 2019-12-13 05:53:04
问题 How can you set a new frame icon on Scala’s scala.swing.Frame class? What are the intentions behind Frame.iconImage: Image and Frame.iconify() ? I can’t figure out, what they’re doing. Here’s my last attempt import scala.swing.Frame class MyFrame extends Frame { iconImage = toolkit.getImage("src/main/resources/icon.png") visible = true } I also tried several other methods, but nothing worked. 回答1: I'm guessing you are on OS X. Sadly, the icon decoration does not work for the OS X look and

3D Effect to buttons in java swing using nimbus

老子叫甜甜 提交于 2019-12-13 04:39:54
问题 I have used Nimbus to create rounded corners for buttons in swing referring here: Use Nimbus to give rounded corners for JButton I now want to give a 3d look to the buttons. How should I go about this using nimbus? i had gone through nimbus but coudnt find appropriate info note: I have added image where button1 shows that I have used: generateButton.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); and second with nimbus effect 回答1: This is more of a suggestion than an answer.

Action from KeyBinding don't execute on a JTable cell

早过忘川 提交于 2019-12-13 04:23:44
问题 im having a problem that is cause i CAN edit the cell when not having focus but when i press the bind key in the cell ("Enter"), action is not performed. But when is has focus, action is performed correctly. I only want to add the keybinding for that specific cell (row,col) , so i added to the textfield in the render. May be im doing something bad. 回答1: As you tab from cell to cell focus in still on the table. The editor is only invoked when you double click with the mouse or use F2 with the

How to use Netbeans' indeterminate progress-bar style?

半世苍凉 提交于 2019-12-12 14:46:35
问题 I'm programming a Java app using Nimbus look & feel. Unfortunately, the appearance of indeterminate JProgressBars of Nimbus look & feel is AWFUL (see below) : On the other hand, I've noticed Netbeans with Nimbus look & feel has a different indeterminate JProgressBar style which looks much better (see below) : How can I use this style in my own application? 回答1: You can write your own Painter<JComponent> : import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import java.beans.*;

Designing simple cell renderer for Nimbus look and feel

穿精又带淫゛_ 提交于 2019-12-12 08:56:23
问题 I have a simple-ish cell renderer which is composed of a few JLabel s (the renderer itself extends JPanel ) and I'm trying to get it to render sensibly in the Nimbus look and feel. Basically what is happening is that in the lighter rows (as Nimbus has alternate row coloring ), my specific cell renderer is using the table background color (which is much darker than both lighter and the darker row colors). In my renderer I do: if (isSelected) { setBackground(table.getSelectionBackground); }

overrides nimbus properties

拜拜、爱过 提交于 2019-12-12 01:49:21
问题 I'm trying to overrides some of the nimbus properties for JLabel. UIDefaults labelDefault = new UIDefaults(); labelDefault.put("Label.font", new FontUIResource("Arial", Font.PLAIN, 14)); labelDefault.put("Label.foreground", new ColorUIResource(210, 210, 210)); label.putClientProperty("Nimbus.Overrides", labelDefault); label.putClientProperty("Nimbus.Overrides.InheritDefaults",false); For the font it works correctly, but not for the color. Is it possible to change the color this way ? Thank

TableCellEditor doesn't show properly

南笙酒味 提交于 2019-12-11 18:57:54
问题 Im having trouble editing a cell, i'll picture cause my english is not very good. I add a TableCellEditor (extends a DefaultCellEditor, i know is not the best but the code is not mine). When i type letters are not , i tried to table.setRowsHeight(comp.getHeight()); works but i don't want this, i want the textfield fix in the row So i tried to comp.setPreferredSize(comp.getWidth(),table.getRowsHeight()) but doesn't work as expected. 回答1: I encountered a similar issue when using the Nimbus look