swing

Why the JProgressBar doesn't respect the setSize()?

心不动则不痛 提交于 2021-02-08 11:52:12
问题 I'm having an issue with the JProgressBar, when it is printed in the GridBagLayout it is too little and the setSize method doesn't have effect, just to test I wrote 100 and 20 but the size remains something about 10x10 and I don't understand why, where is wrong? Thank you! import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event

Why the JProgressBar doesn't respect the setSize()?

*爱你&永不变心* 提交于 2021-02-08 11:52:07
问题 I'm having an issue with the JProgressBar, when it is printed in the GridBagLayout it is too little and the setSize method doesn't have effect, just to test I wrote 100 and 20 but the size remains something about 10x10 and I don't understand why, where is wrong? Thank you! import java.awt.Dimension; import java.awt.Font; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event

JButton in JPanel with gridlayout

*爱你&永不变心* 提交于 2021-02-08 11:34:36
问题 Is it possible to bring it into this shape using the gridlayout? I use empty label to add this empty grid This is my code: import javax.swing.*; import java.awt.*; public class test { public static void main(String[] args) { JFrame frame = new JFrame(); frame.setTitle("Buttons"); frame.setSize(800, 800); int size=12; int flag1=0,count=0,count2=0; frame.setLayout(new GridLayout(1,2,0,0)); JPanel panel = new JPanel(); GridLayout layout = new GridLayout(size,(size*2),0,0); panel.setLayout(layout

NetBeans Platform: How to style the NetBeans GUI components programmatically?

ⅰ亾dé卋堺 提交于 2021-02-08 11:28:26
问题 Intro I have to program a fat client using NetBeans Platform and JavaFX 11. One of the requirements is to offer a default and dark theme mode for the application. So if the user of my GUI application press the dark mode button, the application's GUI changes to the dark style. Problem While its obvious for me how to style the JFX components (via a CSS file), the CSS file doesn't has an impact on the NetBeans Platform's components like the menu bar. For instance the JavaFX components inside a

Adding dynamic line chart to JPanel in existing JFrame using JFreeChart <java>

浪子不回头ぞ 提交于 2021-02-08 11:08:46
问题 I made an application that would show me Max, Minimum, and Average ping when I click "start" in my JFrame application. I made a white box so I could fit a dynamically changing line graph that will be in the same window as my stats, and will update at the same rate as my stats (1 second). No matter how much I google, everybody seems to understand the JFreeChart sample code. I do not understand how to implement that at all. Other tutorials show just the graph as a standalone in its own window.

Adding dynamic line chart to JPanel in existing JFrame using JFreeChart <java>

旧街凉风 提交于 2021-02-08 11:01:07
问题 I made an application that would show me Max, Minimum, and Average ping when I click "start" in my JFrame application. I made a white box so I could fit a dynamically changing line graph that will be in the same window as my stats, and will update at the same rate as my stats (1 second). No matter how much I google, everybody seems to understand the JFreeChart sample code. I do not understand how to implement that at all. Other tutorials show just the graph as a standalone in its own window.

Move row with mouse in JTable

一世执手 提交于 2021-02-08 10:32:19
问题 I have JTable with some rows. I want when move one row with mouse(drag and drop) that row to move together with mouse and table rows to be reorder when mouse move(like moving JTable's columns). This jsfiddle is exactly what i want but i have to do it in java swing(or gif image below. Example is from here but I can't understand it). My TransferHandler : public class TableRowTransferHandler extends TransferHandler { private final DataFlavor localObjectFlavor = new ActivationDataFlavor(Integer

Setting the height of a JTextFrame

陌路散爱 提交于 2021-02-08 10:20:59
问题 The following class creates a form (Jpanel) tasked with acquiring multiples Strings from the user and do something with them. It it functionally working, but it bugs me that the height of the JTextField s (a component that allows for the modification of one line of text) is automatically adjusted and can became extravagantly big. I have tried the method setBounds() , but: I do not want to calculate the position or width of the JTextField , just its height; and It does not limit the height of

Download a BLOB file from database

喜欢而已 提交于 2021-02-08 10:17:10
问题 I need to create a JButton to download a BLOB file from oracle database. This is my JButton code: JButton btnsave = new JButton("Save"); btnsave.setBounds(478, 542, 120, 23); getContentPane().add(btnsave); btnsave.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); This class is already connected to database, but here is part of my code: Connection con; String link="*******************************************"; String u="user"; String p="pw"; Class

Best practise for handling VK_TAB in Java Swing to move between components as well as to move between table cells using the keyboard only

大城市里の小女人 提交于 2021-02-08 09:56:56
问题 I'm trying to find a best practise in terms of accessibility on Tables in relation to other components. In an app that's mainly a set of JTables and JTextFields, I tried to make it accessibility with keyboard as well as mouse. My thoughts are on the best way to help the user to navigate around between components using the VK_TAB key. My first goal was to stop JTables "swallow" the VK_TAB key when the user tries to navigate to a neighbor JTextField using a solution from Coderanch. I tried to