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:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old October 4th, 2002, 03:26 AM
gaspacho soup gaspacho soup is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 5 gaspacho soup User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to gaspacho soup Send a message via AIM to gaspacho soup
Talking newbie java questions

Hi,

I have 2 java questions, and because i'm a bit of a newbie programmer i'd like it if gave examples with any explanations!

1) In an applet, how do i set it so that after an event (like a button click) the GUI gets replaced by a different GUI? so all the previous buttons/textfields/prompts etc are replaced by different buttons and textfields

2) I have an array of objects. This object has 19 arguments (!). Do you think this is too disorganized? and if so, how could i organize it? It's part of a university assignment so readability of code is certainly important.

Reply With Quote
  #2  
Old October 4th, 2002, 04:39 AM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
1) You might try having a function that does getContentPane().removeAll(), the adding your new components. Either one function for each layout or one function that lets you choose layouts.

You could also a Container object for each layout you want then use setContentPane() to switch between them.

2) Yes, that sounds rather disorganized. Any way you can break that down into multiple classes? If not, well, make sure you document it well

Reply With Quote
  #3  
Old October 4th, 2002, 12:39 PM
gaspacho soup gaspacho soup is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 5 gaspacho soup User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to gaspacho soup Send a message via AIM to gaspacho soup
Quote:
1) You might try having a function that does getContentPane().removeAll(), the adding your new components. Either one function for each layout or one function that lets you choose layouts.

hmm...care to give an example?

Reply With Quote
  #4  
Old October 4th, 2002, 01:39 PM
bricker42 bricker42 is offline
Moderator =(8^(|)
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2002
Location: Sacramento, CA
Posts: 1,710 bricker42 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 20 m 38 sec
Reputation Power: 8
Send a message via AIM to bricker42
Code:
public layout2() {
  JLabel label = new JLabel("Dude!");
  label.setHorizontalAlignment(JLabel.CENTER);
  label.setBorder(BorderFactory.createMatteBorder(1,1,2,2,Color.black));

  getContentPane().removeAll();

  getContentPane().add(label, BorderLayout.CENTER);
}

Reply With Quote
  #5  
Old October 4th, 2002, 02:42 PM
gaspacho soup gaspacho soup is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 5 gaspacho soup User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to gaspacho soup Send a message via AIM to gaspacho soup
sank yuu


Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > newbie java questions


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 5 hosted by Hostway