LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-28-2004, 04:43 AM   #1
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Rep: Reputation: 45
java tiny scrollbars


Hi i have created this function for creating constraints

Code:
  
    void buildConstraints(GridBagConstraints gbc,int gx,int gy,int gw,int gh,int wx,int wy){
        gbc.gridx=gx;
        gbc.gridy=gy;
        gbc.gridwidth=gw;
        gbc.gridheight=gh;
        gbc.weightx=wx;
        gbc.weighty=wy;
    }
I have also added the following components...

Code:
 
      setLayout(gridbag);
        
        /*Set the Bold CheckBox */
        buildConstraints(constraints,0,0,1,1,10,10); //? Afou einai void pos epireazei tin constraints
        constraints.fill=GridBagConstraints.EAST;
        gridbag.setConstraints(BoldCheck,constraints);
        add(BoldCheck);
        
        /*Set the Colors */
        buildConstraints(constraints,1,0,1,1,10,10); 
        constraints.fill=GridBagConstraints.NONE;
        gridbag.setConstraints(Colors,constraints);
        Colors.add("Add the Colors");
        add(Colors);
        
        /*Set the Italic Checkbox */
        buildConstraints(constraints,2,0,1,1,10,10); 
        constraints.fill=GridBagConstraints.WEST;
        gridbag.setConstraints(ItalicCheck,constraints);
        add(ItalicCheck);
        
        /*Set the Text Area */
        buildConstraints(constraints,0,1,3,1,10,10); 
        constraints.fill=GridBagConstraints.WEST;
        gridbag.setConstraints(WriteText,constraints);
        add(WriteText);
        
        /*Set the Red Scroll Bar */
        buildConstraints(constraints,0,2,3,1,30,10); 
        constraints.fill=GridBagConstraints.NONE;
        gridbag.setConstraints(Red,constraints);
        add(Red);
        
        /*Set the Blue Scroll Bar */
        buildConstraints(constraints,0,3,6,1,30,10); 
        constraints.fill=GridBagConstraints.NONE;
        gridbag.setConstraints(Blue,constraints);
        add(Blue);
        
        /*Set the Green Scroll Bar */
        buildConstraints(constraints,0,4,3,1,30,10); 
        constraints.fill=GridBagConstraints.NONE;
        gridbag.setConstraints(Green,constraints);
        add(Green);
        
        /*Set the Font Choice */
        buildConstraints(constraints,0,5,1,1,30,10); 
        constraints.fill=GridBagConstraints.NONE;
        gridbag.setConstraints(Fonts,constraints);
        for (int i=0;i<FontNames.length;i++)
            Fonts.add(FontNames[i]);
        add(Fonts);       
        
        /*Set the Size Choice */
        buildConstraints(constraints,2,5,2,1,30,10); 
        constraints.fill=GridBagConstraints.NONE;
        gridbag.setConstraints(Size,constraints);
        for (int i=5;i<25;i++)
            Size.add(String.valueOf(i));
        add(Size);
I try to find out why my 3 scrollbars appear in so small size
Have a nice day
 
Old 05-28-2004, 12:33 PM   #2
towlie
Member
 
Registered: Apr 2004
Location: U.S.
Distribution: slackware 10.0
Posts: 110

Rep: Reputation: 15
IMHO, java's gui stuff is really difficult to program with, (especially when
you need stuff in an exact position in the windo).

but you might try increasing the gridwidth of the scroll bar (the 4th arg
of your function) although this could make things look strange.

you can also try the setPrefferedSize() method for the scroll bar objects.

i have found that this method usually works.

the thing is, those grid bag properties effect how the element is distributed
relative to the grid, but i don't think they effect the pixel size of the element itself.
 
Old 05-29-2004, 05:20 AM   #3
alaios
Senior Member
 
Registered: Jan 2003
Location: Aachen
Distribution: Opensuse 11.2 (nice and steady)
Posts: 2,203

Original Poster
Rep: Reputation: 45
Thx...really thx for yor reply.... Fortunately i can't increase the size of my scrollbar...
I can't find the SetPreferredSize....for my Scrollbars
 
Old 05-29-2004, 12:42 PM   #4
aaa
LQ Guru
 
Registered: Jul 2003
Location: VA
Distribution: Slack 10.1
Posts: 2,194

Rep: Reputation: 47
Can you post the whole code? We can't tell what kinds of components these are.
Edit: Also, increasing the number of cells gives more control over how big things are (make bigger stuff span multiple cells)

Last edited by aaa; 05-29-2004 at 01:06 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
No Scrollbars Hectic Slackware 2 10-12-2004 06:06 PM
Looking for a tiny motherboard.... np complete Linux - Hardware 6 09-26-2004 10:06 AM
REALLY tiny distros e1000 Linux - Distributions 5 11-10-2003 07:04 PM
tiny mandrake 9.1 FF103 Linux - Laptop and Netbook 3 11-05-2003 09:49 AM
looking for a tiny distro royce2020 Linux - Distributions 8 05-08-2003 06:13 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration