All Questions
6,286
questions
-1
votes
1
answer
26
views
Resize JPanel with animation
I want to make a panel that, when the mouse enters it, its height increases smoothly and when the mouse leaves it, its height decreases smoothly.
public class Main {
private static final int ...
-1
votes
0
answers
31
views
Adding margin to the panel inside a JScrollPane
I have a panel with a BoxLayout layout and I want this panel to have a scrollbar, so I made a JScrollPane. But when I use JScrollPane, the emptyBorder that I add is not added to my panel
JPanel panel =...
0
votes
1
answer
34
views
My components in two different panels are too small and don't fit to the frames size, how can I fix this?
I made a JFrame (size: 500 , 600) that uses GridBagLayout to place two JPanels (one using GridLayout and the other using GridBagLayout) on top of each other; however, when I run my JFrame the ...
0
votes
0
answers
25
views
Add Component Java Swing
Good,
I have a custom component that extends JPanel. I add it to the Netbeans palette and everything works ok. I have added an addContainerListener and I have filled the componentAdded method but it ...
1
vote
0
answers
43
views
Starting X and sometimes Y coordinate of JFrame is displaced
Just recently started playing around more with Swing and right now I am trying to build an Algorythm Visualiser. The array being displayed is displaced. The starting X coordinate is shifted to the ...
1
vote
1
answer
70
views
Graphics2d on JPanel
I want to make a program in Java that drops a square at the position of your mouse. For that I wanted to draw a grid as background and then add the squares but as soon as I add a new component to the ...
0
votes
0
answers
28
views
JPanel and Grid Layout modification
I have been trying to modify the contents of a gridlayouts in a panel i created(Java by the way Ecliplse), but no method ive tried is working this is the code:
// Planning to add about 6 more buttons ...
0
votes
1
answer
62
views
Java/Swing: Can't get JScrollPane to show entire element
The goal is to draw a bunch of circles (each a separate JComponent instance) onto a JPanel, and to be able to scroll far enough in any direction to see all of them.
Here is the "main" code:
...
1
vote
2
answers
39
views
Custom component is not shown on JPanel
I am new to the java swing library and am trying to create my own components. In this case I have a Circle class extending the JComponent class. However, when trying to add an instance of the Circle ...
0
votes
0
answers
30
views
Java Swing problems with invoking paintComponent() in Sub-Subclass?
I want to paint node structures with Java Swing.
There's a class
NodeView extends JPanel
and three subclasses representing individual tree structures.
These subclasses are extending NodeView (e.g. ...
0
votes
1
answer
36
views
Frame showing up super small Java Swing
could someone tell me why my frame is showing up super small/minimized? I thought I just had to pack my frame to resolve the issue but packing my frame does not seem to have any effect on the outcome.
...
0
votes
1
answer
46
views
Problems with moving an object in Java Swing
I'm having trouble displaying the movement of a custom Jbutton object in Jpanel that has been added to the Jframe.
The chart is displayed but when the startMovement method is called the chart ...
0
votes
1
answer
25
views
How to draw custom components on a resizeable JPanel with a specific coordinate system?
I'm working on a graph-tree visualizing application. The program could create different layouts for visualizing trees. By tree I mean a Node object which could have a Node as a parent, and a list of ...
0
votes
1
answer
48
views
Get accurate coordinates within JPanel in a JFrame
How does one get accurate xy coordinates from a JPanel placed within a JFrame.
I tried figuring this out on my own but the coordinates are slightly off and I dont know why.
I know this probably isn't ...
0
votes
1
answer
99
views
printing half of the panel
Good Evening stack overflow,
I'm trying to print Jpanel on the "zebra gk420t" printer but when i gave it the order its only print the half of my panel like in Image.
import java.awt.Graphics;...