Skip to content

Tag: swing

Need help on Java Swing JFrame

I’m very new to Swing and I need to build a JFrame that: Has an image on top. Below the image has 16 little images divided into 4 groups (4 “panels”), on the same “row”. Below those 16 images I need 4 “panels” on the same “row”. Every panel contains some h…

How to use drag and drop in IntelliJ for java swing

I am using IntelliJ for java application development using swing . It is difficult to manage content using layout manager. So, is there is any facility to make drag and drop features like in visual studio for vb.net… Answer You can use IntelliJ’s GUI designer JetBrains website has some resources d…

How to change height of a jpopupmenu in a jcombobox?

I am working on an application in which I am handling key release event over a editable ‘JComboBox’, where on every key release a ‘JPopupMenu’ of the ‘JComboBox’ appears. I want to increase the height so that user will be able to see more items at a glance without scrolling…

How to open multiple windows with Processing?

I’m trying to create two windows with Processing. Before you mark this as a duplicate, as there are other questions similar to this, I have a specific error and I can’t find a solution. When I try to add(s) I get the error The method add(Component) in the type Container is not applicable for the a…

GridBagLayout gridwidth doesn’t work as expected

I’m working with the java swing LayoutManager GridBagLayout, and ran into this problem. I want a layout like this ACC BB But get a layout like this ACC B A and B take up the same number of columns despite B having a gridwidth of 2 where A’s gridwidth is 1. I don’t think there can be a vanish…

Referencing from an inner class

I have the following code My aim here is to create an array of JTextFields which have a keylistener on. This keylistener should prevent anything other than numbers being entered in the JTextField. It should also change the color of the JTextField’s background if the number entered is not an int. For exa…

Restrict JTextField to only accept certain characters

I have 4 JTextFields that should only accept certain characters: binary digits (0, 1) octal digits, so (0 – 7) all digits (0 – 9) all hexadecimal characters (0 – 9, a – f, A – F) The user must not be able to input a forbidden character. I know how I could validate the input after…