jpanel

displaying an image on the screen in java

There is a code that should display the image on the screen. Initially, I tried to output just a line, and everything worked ... g.drawImage(img, 0, 0, null);//выводим линию g.drawLine(20, 20, 200, 200);//выводим изображение } }

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);

JFrame add image

Guys, how to add a picture to the window correctly? When I add it, it goes off the screen. import java.awt.Graphics; import ... mageIcon(src).getImage(); } public void drawIcon() { Graphics g = getGraphics(); g.drawImage(img, 0, 0, null); } }

Java GUI component display problem

I am writing an application using Java / Swing and I also encountered a problem: When displaying a JFrame, the components are ... apg = new AllPosts_GUI(); jFrame.getContentPane().add(apg); jFrame.pack(); jFrame.setVisible(true); } }

java How to hide JPanel correctly

I want to hide one panel by clicking the Button, which will allow you to see another one I have this code class MyWindow ext ... displayed, but after the start button, the centrePanel panel is closed, and there is nothing, how to implement it correctly?

How to boot a blank JPanel?

I'm starting to work with the swing and event manipulation package and here I came up with an idea to test some program that ... rgura, altura); } public void actionPerformed(java.awt.event.ActionEvent ev) { painel.repaint(); } } }

Blocking the interface in NetBeans

I am developing a program for communication between client and server. I am developing the graphical interface of the progra ... } } }; recever.start(); }