Hello guys!
I've created a JFrame with a JPanel in Netbeans and then I moved the project in Eclipse.
In the JPanel I put a grid layout with buttons. I want that these buttons have no border.
But setborder(null) is not working :(
I have already one project in eclipse and there setborder(null) is working..
I actually don't know what to do.. is there some trick or something, is something wrong with my container (JPanel)?
Thx
5 replies to this topic
#1
Posted 26 November 2011 - 09:33 AM
|
|
|
#2
Posted 27 November 2011 - 09:13 AM
Hi guys..
So I tried also this:
Border empty;
empty = BorderFactory.createEmptyBorder();
start.setBorder(empty);
And is also not working.. does someone have any idea?
So I tried also this:
Border empty;
empty = BorderFactory.createEmptyBorder();
start.setBorder(empty);
And is also not working.. does someone have any idea?
#3
Posted 27 November 2011 - 09:24 AM
Have you tried using the setBorderPainted(false); method?
#4
Posted 27 November 2011 - 10:06 AM
Yes I've tried and nothing..
Could it be that because of some library it doesn't work?
Could it be that because of some library it doesn't work?
#5
Posted 27 November 2011 - 10:34 AM
This seems to be working for me (using setBorderPainted(false))
public static void main(String[] args) {
// TODO Auto-generated method stub
JFrame frame = new JFrame("frame");
JPanel panel = new JPanel() {
public Dimension getPreferredSize() {
return new Dimension(100, 100);
}
};
JButton button = new JButton("Hello");
button.setBorderPainted(false);
panel.add(button);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setContentPane(panel);
frame.setLocationRelativeTo(null);
frame.pack();
frame.setVisible(true);
}
#6
Posted 27 November 2011 - 10:44 AM
I believe you that is working.. on some of my project is working too..
I don't know what's wrong with this my project. As I sad I created GUI in Netbeans and then put it in Eclipse..
I've also tried to put the border away in Netbeans and still it's not working... don't know where is the problem.. :/ :confused:
I don't know what's wrong with this my project. As I sad I created GUI in Netbeans and then put it in Eclipse..
I've also tried to put the border away in Netbeans and still it's not working... don't know where is the problem.. :/ :confused:
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









