I want to create a 'generic' JPanel which can be rendered in any of the higher level Window classes (JFrame, JDialog, or JInternalFrame to be somewhat precise.)
I want to be able to 'clean up' some static values when that window is no longer being rendered on screen. Normally, I would do this with a Window class (like JFrame) and simply...
I have the following class which implements 3 JPanels. 1 Panel has a label, next are the buttons and the third is a table as described in my code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.table.*;
import java.util.*;
import javax.swing.event.*;
class netTable implements ActionListener, Tab...
Server is a class I made that extends JFrame.
Server serverApp = new Server(TITLE, WIDTH, HEIGHT, true, false);
I've effectively removed almost all the other code but the problem still remains!
c = getContentPane();
c.setLayout(new BorderLayout());
//Components /***AHHHHH***/
lblEnterMessage = new JLabel("Enter ...
I have a class that extends javax.swing.JPanel, it contains a single JButton. I've created the class in NetBeans designer. As such, I have a initComponents() function thats called from the class constructor.
What I want to do is when/if a function is called, I want to add a second button, and change the layout of the two buttons. Doing ...
I want to implement some functionality in a library and make it available as a GUI building block for my applications. I think I would like to implement it as something that extends a JPanel, so it can be embedded as a component in other windows.
Is there a reason I should use a JDialog instead? How easy is it to create a JDialog which ...
I need to pick a standard container (JPanel?) in Swing that I can use as a placeholder to which I can add another custom component that extends JPanel:
JPanel containerPanel;
// built by a library from a text file, automatically part of a nice layout
MyPanel componentPanel;
// something complicated that I can't integrate with the build...
Hi, I have the following:
import javax.swing.JFrame;
public class Directions {
public Directions(){
JFrame frame = new JFrame("Direction");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new DirectionPanel());
frame.pack();
frame.setVisible(true);
}
...
Hi all! Anybody know how can I clone a JPanel to Paint the same thing in both, in the original panel and the clone panel, like if the objects were a mirror, but using CLONE, so I can REPAINT() one, and the other will do the same automatically.
My code only paints the original JPanel if I move the mouse in the original or in the clone pa...
Hi all! Anybody know how can I repaint in a clone JPanel. Im using CLONE, so I can REPAINT() one, and the other will do the same automatically.
My code only paints the original JPanel if I move the mouse in the original or in the clone panel,
but If I move the mouse in the clone panel, this jpanel doesn't paint.
Thanks in advance
COD...
I am using a JPanel (with several labels inside) to add a dynamic information on a graph. This panel is dynamically created, it is not visible before I use it to draw.
For this, I am using a BufferedImage, and I follow approximately the same steps as described on this other question. It works good, as long as I specify all sizes (the pa...
Hi guys, I had problem using a very simple frame containing two JPanel.
The problem is on the layout of the Center JPanel that contains four JButton.
How can I set a better size for buttons or directly for JPanel that uses the GridLayout. On the picture the problem:
!
Here the code: ` JFrame window = new JFrame("Horrible! LOL");
...
Hi,
I've got a Problem: In my Java application I've got an AWT Component (cannot change that one) that streams and shows an avi-file. Now I want to draw upon this movie and thought about putting a transparent JPanel above it and draw on that one.
This does not work since I either see the avi-stream or the drawn lines but not both.
I r...
I have Java applet to draw an array (just some rectangle one after another).
When user select to create array of size n, it will draw n rectangles connected together. When n gets bigger, the graphics get bigger, but since i use JPanel to draw the array, and JPanel won't scroll, i have to add that JPanel into a JScrollPane, but still it ...
I'm currently working on making my Swing application look better. I want to achieve something along these lines:
The idea is for each box to have a pretty header with a background similar to the above image. The closest I can get to anything like this using basic Swing components is adding a TitledBorder but this is nothing close to w...
Hi,
I am trying to display a circular object in my gui, the circular object should contain a few labels therefore I thought the circle object should extend JPanel. Does anyone know how to make a circular JPanel? Or at least a JPanel which paints an oval and places a few JLables in the centre of the oval?
Thanks
...
Hello,
I'm trying to dispose my JFrame by clicking a button, located on a JPanel that is placed on the JFrame that I want to close.
I tried to make a static method on the JFrame class, but ofcourse my IDE told me that wasn't going to happen.
Anyone thinking of a solution?
Thanks!
...
I'm working on recreating "Legend of Zelda a Link to the Past" as part of an assignment.
And I've got the following problem, the game world is a BufferedImage of which I subImage() the part I need for the current location of the player. The game works but uses 80 / 110 percent of the CPU. A profile revealed that the culprit is the drawi...
I'm creating a graphical roguelike game using Java. In the game, I'm painting a 2d array of Tile objects onto a JPanel. These Tile objects represent the ground. I have a .bmp sprite sheet that contains all of the textures I want to use to paint with. Every time the player moves, the tiles that are visible to the player need to be redrawn...
Just a quick question here. I have a program in which I need to create a number of JPanels, which will then each contain some objects (usually JLabels).
There are a few operations that I have to do each time i create a new JPanel, and I'm wondering if the order in which I do them has any bearing, or if there is a standard practice.
Th...
I'm drawing shapes inside this JPanel, which is also inside another main JPanel. At repaint() it only draws the shapes for one millisecond and then they disappear. They don't stay painted, why?
my paintComponent method is something like this
@Override
public void paintComponent(Graphics g) {
super.paintComponent(g);
for (in...