swing

How to draw graphs in Java?

How to draw graphs in Java?

java swing how to add boxlayout

I am writing a program that will calculate the resistance of resistors connected in parallel Now I have this and it outputs ... hy everyone creates panels everywhere, and I just have add (panel1); and there should be something like panel. add (button) ?

Drawing an image rotated in the direction of movement | Graphics | Graphics2D

It is necessary to draw the image rotated in the direction of movement (the rotation should be relative to the center of the ... e to the center and the rotation is incorrect Details: I draw on JPanel in the method paint(Graphics gr) Using Graphics2D

Timer in Java Swing

How do I create a timer that will perform an action after a given time has elapsed? For example, you need to say System.out.print("Hi!"); after 4 seconds

How to change Look and Feel (Swing)

I am writing a GUI application in Java Swing. I need to change the Look and Feel to non-standard, i.e. to FlatLaf. How do I d ... tQueue.invokeLater(new Runnable() { public void run() { new Home().setVisible(true); } }); }

Java Graphics

Good day, hashkodovtsy! I don't even know how to start the question, in general, my code doesn't work with Java Graphics. No ... aint(Graphics g){ g=(Graphics2D)g; g.setColor(Color.BLACK); g.drawLine(20, 20, 360, 20); } }

Constantly updating JLabel

I want to make a clock in Java (Swing) and then there was a problem. At first, I wanted to do the update through an infinite ... know how to implement it, there is an assumption that it can be done through multithreading. Please advise me how to do this.

How do I print a large PNG on an A4 sheet?

I want to print an image on A4 that I get programmatically. Here is the method for getting the image: public BufferedIma ... ything. What could be the problem? I I don't know what to think, tell me. P.S. The size of the image comes out 1426Х756 пикс

ActionListener when working with Java Swing

It is necessary that when you click on the button, the color of the textfield changes... But it is necessary that the conditi ... Dialog(null, "Номер успешно забронирован!"); roomField1.setBackground(new Color(204, 0, 0)); } } });

Dynamic addition of Swing rectangles (Java)

You need to implement the addition of rectangles (the entire width of the window) with the colors of the rainbow. When the la ... } } I understand that the rendering should be in a loop, but I don't understand how to do dynamic rendering in real time.

Strange situation with java. net. SocketTimeoutException: Connect timed out

Hello. I don't understand one thing. The following code in a simple application is worked out "perfectly": package javaa ... Text(""); } }); ******************************************************* Why is the error being returned?

Thread.sleep doesn't work in ActionListner

I'm looking for a solution to the problem on the network - I can't find it. I want to make sure that when you click on the Pr ... ame.EXIT_ON_CLOSE); frame.setLayout(new GridLayout()); frame.setVisible(true); return frame; } }

Manual input in JDatePicker

When manually entering the date, an error occurs Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: ... r) value; return dateFormatter.format(cal.getTime()); } return ""; } } }

Select layout for a form in Java

I can't select Layout for JFrame. The task is to arrange the elements(panels) in the form as here The panels will be diffe ... t but aligned in width. I tried it GridLayout, GridBagLayout and FlowLayout while there was a continuous dance of components.

Drawing a JButton with a round shape

Is it possible to make JButton round? If possible, by what means?

How do I add a JScrollPane to a JPanel?

There are 20 buttons on the panel. How do I add a slider to this panel so that I can select a button? UPD: added code from t ... roller.setHorizontalScrollBarPolicy(ScrollPaneConstants.HO‌​RIZONTAL_SCROLLBAR_N‌​EVER); add(BorderLayout.EAST , scroller);

Swing java output of windows after clicking on the button

I made a prog, it displays a window with 4 buttons. How do I make it so that after clicking on any of them, another window is ... static void main(String[] args) { InterfaceCalq inter = new InterfaceCalq(); inter.setVisible(true); } }

How do I show a BufferedImage image in a JFrame window?

There is an image image of the BufferedImage type. You need to display it in the window type JFrame.

Displaying without extension when selecting a file in JFileChooser

It is necessary that when you select a file in JFileChooser, the file is displayed without the extension. How? Is there a bet ... is case, the selection marker jumps up. And JFileChooser returns an incorrect file name (returns a file without an extension)

Your Cursor

Good afternoon. How can I change the standard cursor arrow to my own image in java?