Thread: GUI troubles

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Location
    Kiev, Ukrain
    Posts
    88
    Rep Power
    2

    GUI troubles


    Hello. I Have some problems with size f my buttons .
    I'm trying to resize it in anyway i can,but everything is useless. Button size is fitted to layout .
    Code:
    static JButton btn1 = new JButton ("New");
    static Dimension btndim = new Dimension(90, 40);
    
    public static void prepare (){
    		btndim.setSize(90.0, 40.0);
    		btn1.setPreferredSize(btndim);
                                 btn1.setMinimumSize(btndim);
                                 btn1.setBounds(0, 0, 100, 50);
                                 btn1.setBounds(btnrect);
    		tb1.add(btn1);
    		Frame.add(tb1);
    		Frame.setSize(800, 500);
    		Frame.setResizable(false);
    		Frame.setVisible(true);
    }
    my output is toolbar covers all the frame and small 10x7 btn on it.
  2. #2
  3. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2004
    Location
    Mobile, Alabama
    Posts
    4,020
    Rep Power
    1285
    What LayoutManager are you using?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Location
    Kiev, Ukrain
    Posts
    88
    Rep Power
    2
    I didn't use it at all. Just googled it .What is this manager for ? Could you explain. I thought that it's used only for setting the layout position.
  6. #4
  7. Java Junkie
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jan 2004
    Location
    Mobile, Alabama
    Posts
    4,020
    Rep Power
    1285
    what is tb1?
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Location
    Kiev, Ukrain
    Posts
    88
    Rep Power
    2
    oh sorry . it's ToolBar :
    JToolBar tb1 = new JToolBar();

IMN logo majestic logo threadwatch logo seochat tools logo