Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old February 18th, 2003, 07:25 PM
Statik Statik is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 129 Statik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Having trouble with setsize

Hi all. I'm having trouble with setsize. I've seen that there is a known problem with setsize, but I'm unsure of the solution. Here's a section of code. I'm trying to set the size of the read 'Clear' button. Any help?
PHP Code:
//Create the navigation bar at the top of the applet
        
JPanel jpNavigation = new JPanel();  //Create the navigation panel
        
jpNavigation.setLayout(new BorderLayout());
        
          
//Create the Student control Panel
            
JPanel jpStudentControl = new JPanel();
            
jpStudentControl.setLayout(new BorderLayout());
                    
JButton jbtStudentDown = new JButton("<=");
                    
JButton jbtStudentUp = new JButton("=>");
                
jpStudentControl.add(jbtStudentDownBorderLayout.WEST);
                
jpStudentControl.add(new Label("Students"), BorderLayout.CENTER);
                
jpStudentControl.add(jbtStudentUpBorderLayout.EAST);
                
jpStudentControl.add(new Label("A Total Of"), BorderLayout.SOUTH);
            
          
//Create the Clear Button
            
JPanel jpClearPanel = new JPanel();
                
JButton jbtClear = new JButton("Clear");
                
jbtClear.setSize(50,40);
                
jbtClear.setBackground(new Color(255,0,0));
            
jpClearPanel.add(jbtClear);
            
          
//Create the Course control Panel
            
JPanel jpCourseControl = new JPanel();
            
jpCourseControl.setLayout(new BorderLayout());
                    
JButton jbtCourseDown = new JButton("<=");
                    
JButton jbtCourseUp = new JButton("=>");
                
jpCourseControl.add(jbtCourseDownBorderLayout.WEST);
                
jpCourseControl.add(new Label("Courses"), BorderLayout.CENTER);
                
jpCourseControl.add(jbtCourseUpBorderLayout.EAST);
                
jpCourseControl.add(new Label("A Total Of"), BorderLayout.SOUTH);
        
        
jpNavigation.add(jpStudentControlBorderLayout.WEST);
        
jpNavigation.add(jpClearPanelBorderLayout.CENTER);
        
jpNavigation.add(jpCourseControlBorderLayout.EAST);
        
        
getContentPane().add(jpNavigationBorderLayout.NORTH);
        
        
JPanel p2 = new JPanel();  //Create the Student Panel
        
JPanel p3 = new JPanel();  //Create the Course Panel
        
JPanel p4 = new JPanel();  //Create Bottom Panel
        
        
        
p2.add(new Label("Student"));
        
p3.add(new Label("Course"));
        
p4.add(new Label("Bottom"));
        
        
getContentPane().add(p2BorderLayout.WEST);
        
getContentPane().add(p3BorderLayout.EAST);
        
getContentPane().add(p4BorderLayout.SOUTH);
    } 

Reply With Quote
  #2  
Old February 19th, 2003, 10:27 AM
Nemi Nemi is offline
Clueless llama
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Feb 2001
Location: Lincoln, NE. USA
Posts: 2,353 Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level)Nemi User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 2 Days 12 h 35 m 19 sec
Reputation Power: 111
try setPreferredSize()

Reply With Quote
  #3  
Old February 19th, 2003, 04:08 PM
Statik Statik is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 129 Statik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
C:\Program Files\Xinox Software\JCreator Pro\MyProjects\TME04\TME04.java:272: setPreferredSize(java.awt.Dimension) in javax.swing.JComponent cannot be applied to (int,int)

setPreferredSize is not valid on the JButton anyway.

Any others?

Statik

Reply With Quote
  #4  
Old February 19th, 2003, 04:12 PM
Statik Statik is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2001
Posts: 129 Statik User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Got it:

setPreferredSize(new Dimension(50,40));

Statik

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Having trouble with setsize


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway