All Questions

197
votes
11answers
34464 views

How to add JTable in JPanel with null layout?

I want to add JTable into JPanel whose layout is null. JPanel contains other components. I have to add JTable at proper position.
12
votes
4answers
2101 views

Why is it frowned upon to use a null layout in Swing?

Recently, I started creating a program for the company I work for. Just as background info, I'm still a student and a beginner programmer, so my solution is probably not recommended and I didn't know ...
2
votes
4answers
3944 views

JButton() only working when mouse hovers

import java.awt.*; import java.awt.image.*; import java.awt.event.*; import javax.imageio.*; import java.lang.*; import java.io.*; import javax.swing.*; public class Ma...
1
votes
4answers
473 views

What's wrong with the Null Layout in Java?

Bonjour. Upon spending countless hours around this site looking for code to drag a component around the screen, I noticed an odd trend growing in the answers. ...being that everyone shudders at the ...
1
votes
2answers
435 views

setLocation of Label

I have all of the labels working correctly but the userLabel[3] is not positioning properly No matter what I do, the label "Color:" always shows up on the frame with a x-coordinate of 0 and a y-coordi...
1
votes
2answers
9143 views

JLabel won't show with JPanel.setLayout(null). Why?

I want to show many different labels over a map, so I'm using null layout in my panel, and calling setLocation for each label. For some reason, though, the labels don't show. If I remove the pan.setLa...
8
votes
6answers
64768 views

Placing a JLabel at a specific x,y coordinate on a JPanel

I'm trying to place a series of JLabels at specific X and Y coordinates on a JPanel (and set its height and width, too). No matter what I do, each label winds up immediately to the right of the previo...
0
votes
2answers
18952 views

Widgets behaving strangely when using "setlayout(null)"

I'm doing the following call in my code: ... setLayout(null); ... I'm trying to place a button and a textfield by specifying their x and y coordinates. The problem when I run the program (either w...
8
votes
4answers
50225 views

How to set fix size of jlabel?

I am trying to make a java desktop application where I am using multiple JLabel I want to set fix height and width of JLabel. How can I achieve this? Here is my code public class Second extends JFr...
1
votes
2answers
15959 views

Using a JPanel with a null layout

So I have a class called CalendarPanel that extends JPanel. It uses a null layout. How would I use CalendarPanel as a regular component? When I put it in another JPanel and then add it to a window, it...

Previous Next