Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.gui > #2052 > unrolled thread
| Started by | "Oberon" <oberon@THRWHITE.remove-dii-this> |
|---|---|
| First post | 2011-04-27 15:36 +0000 |
| Last post | 2011-04-27 15:36 +0000 |
| Articles | 8 — 4 participants |
Back to article view | Back to comp.lang.java.gui
Changing Panel view from "Oberon" <oberon@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: Changing Panel view f "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: Changing Panel view f "Oberon" <oberon@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: Changing Panel view f "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: Changing Panel view f "Mr. N. Marshall" <mr..n..marshall@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: Changing Panel view f "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: Changing Panel view f "Mr. N. Marshall" <mr..n..marshall@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
Re: Changing Panel view f "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> - 2011-04-27 15:36 +0000
| From | "Oberon" <oberon@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | Changing Panel view from |
| Message-ID | <1184422259.536805.33910@o61g2000hsh.googlegroups.com> |
To: comp.lang.java.gui
Hi all.
I hava a problem with my Gui. I have:
1 Frame with 2 panels (JPanel)
on first JPanel I have JComboBox object
and on second panel i want to have different objects for each
JComboBox Item :(JSlider, JTable etc) and i dont know how to do this.
I'm beginner in java
My code that works bad (creating a another Jpanel inside second JPanel
depending of choice JComboBox)
public class MainFrame extends JFrame{
(...kod...)
public MainFrame(){
(...kod...)
//mainDesktops@MainFrame
//1->z modelami
mainDesktop1 = new JPanel();
comboBox =new JComboBox();
mainDesktop1.add(comboBox);
comboBox.setBackground(Color.WHITE);
for(int i=0; i<comboBoxItems.length;i++)
comboBox.addItem(comboBoxItems[i]);
comboBox.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent eve){
mainDesktop2.removeAll();
mainDesktop2.validate();
mainDesktop2.add( setView(comboBox.getSelectedIndex()),BorderLayout.CENTER );
validate();
}//actionPerf
});
//2 -> opcje modeli
mainDesktop2 = new JPanel();
titleBorder2 =
BorderFactory.createLineBorder(Color.RED);
add(mainDesktop2,BorderLayout.CENTER);
mainDesktop2.setBackground(Color.BLACK);
mainDesktop2.setBorder(new
javax.swing.border.TitledBorder(titleBorder2,titleBorder));
}//konstruktor
JPanel setView(int wybor){
JPanel pan = new JPanel();
if (wybor==0){
bscLabel.setText("\n BER - probablity: \n" +
(int)(bscKanal.getProbablity()*100) +"%");
bscLabel.setForeground(Color.BLUE);
bscSlider.setMajorTickSpacing(20);
bscSlider.setPaintTicks(true);
bscSlider.setPaintLabels(true);
bscSlider.setBorder(BorderFactory.createLineBorder(Color.GRAY, 2));
bscKanal.setProbablity(bscSlider.getValue()/
100);
pan.add(bscLabel);
pan.add(bscSlider,BorderLayout.AFTER_LAST_LINE);
}
return pan;
}
}//class
I will be thankfull if someone show a code that changing panel view
from JComboBox or any Idea how to do this
thanks
---
* Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [next] | [standalone]
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | Re: Changing Panel view f |
| Message-ID | <752a173e0439d@uwe> |
| In reply to | #2052 |
To: comp.lang.java.gui Oberon wrote: .. >...i want to have different objects for each >JComboBox Item :(JSlider, JTable etc)... A CardLayout might suit this. >... and i dont know how to do this. >I'm beginner in java A good group for beginners in Java is comp.lang.java.help >My code that works bad .. .it compiles bad as well. After commenting the lines where it mentions missing code, and adding imports, I realised I'd have to define all the components as well, and stopped. >I will be thankfull if someone show a code .. .and usually SSCCE's* work best, for explaining code problems. * <http://www.physci.org/codes/sscce.html> -- Andrew Thompson http://www.athompson.info/andrew/ Message posted via http://www.javakb.com --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Oberon" <oberon@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | Re: Changing Panel view f |
| Message-ID | <1184426315.433661.133890@q75g2000hsh.googlegroups.com> |
| In reply to | #2053 |
To: comp.lang.java.gui > A CardLayout might suit this. Hmmm i think it good advice. thanks > >... and i dont know how to do this. > >I'm beginner in java > > A good group for beginners in Java is comp.lang.java.help I thought that the problem is not beginner and fit in this forum Sorry if I'm wrong. > >My code that works bad .. > > .it compiles bad as well. After commenting the lines > where it mentions missing code, and adding imports, > I realised I'd have to define all the components as > well, and stopped. Ok sorry (but i post this code only for global schema and idea - it is part of program) Thanks a lot Rafal --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Andrew Thompson" <andrew.thompson@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | Re: Changing Panel view f |
| Message-ID | <752a8fa10a714@uwe> |
| In reply to | #2054 |
To: comp.lang.java.gui Oberon wrote: .. >...i post this code only for global schema and idea ... An SSCCE is a great way to communicate the idea. Please read the linked article. I highly recommend it (not surprising, since I wrote it). -- Andrew Thompson http://www.athompson.info/andrew/ Message posted via JavaKB.com http://www.javakb.com/Uwe/Forums.aspx/java-gui/200707/1 --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Mr. N. Marshall" <mr..n..marshall@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | Re: Changing Panel view f |
| Message-ID | <4699221b$0$8844$9a566e8b@news.aliant.net> |
| In reply to | #2055 |
To: comp.lang.java.gui Andrew Thompson wrote: > Oberon wrote: > .. >> ...i post this code only for global schema and idea ... > > An SSCCE is a great way to communicate > the idea. Please read the linked article. I > highly recommend it (not surprising, since > I wrote it). > http://mindprod.com/jgloss/sscce.html Short Self-Contained Compilable Example, a term coined by Andrew Thompson to describe the desired form of code snippets posted in newsgroups. Not only did he write the article, he coined the term.. well done sir. -- N. Marshall There are 10 types of people in the world: Those that know binary Those that do not know binary --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | Re: Changing Panel view f |
| Message-ID | <heji93tpsmsg4pm7uh044uqen61ve5ec8v@4ax.com> |
| In reply to | #2056 |
To: comp.lang.java.gui On Sat, 14 Jul 2007 16:20:56 -0300, "Mr. N. Marshall" <mr_n_mashall@hotmail.NOSPAM.com> wrote, quoted or indirectly quoted someone who said : >http://mindprod.com/jgloss/sscce.html > >Short Self-Contained Compilable Example, a term coined by Andrew >Thompson to describe the desired form of code snippets posted in newsgroups. It has been said that genius is the ability to formulate clear useful questions. The SSCCE helps train newbies to ask such questions. Further in the work of preparing the question, they often solve it themselves. A more advanced user on formulating a question can try to predict the various acidic withering responses and prepare defences. In preparing those defences, often the solution pops out. I think we must be careful to give newbies lots of leeway. The tendency for them is to give up, play helpless or to accept the opinion of an "expert" they are irretrievably stupid. Getting them to prepare an SSCCEE is a great antidote. -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Mr. N. Marshall" <mr..n..marshall@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | Re: Changing Panel view f |
| Message-ID | <46998095$0$8852$9a566e8b@news.aliant.net> |
| In reply to | #2061 |
To: comp.lang.java.gui Roedy Green wrote: > I think we must be careful to give newbies lots of leeway. The > tendency for them is to give up, play helpless or to accept the > opinion of an "expert" they are irretrievably stupid. > > Getting them to prepare an SSCCEE is a great antidote. I agree. It also forces them to think, which therefore eliminates alot of the ones who are only seeking homework answers, or who have not learned that GIYF. -- N. Marshall There are 10 types of people in the world: Those that know binary Those that do not know binary --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [next] | [standalone]
| From | "Roedy Green" <roedy.green@THRWHITE.remove-dii-this> |
|---|---|
| Date | 2011-04-27 15:36 +0000 |
| Subject | Re: Changing Panel view f |
| Message-ID | <tjai931bsce2o8ghbc6il760l0pd7qbivq@4ax.com> |
| In reply to | #2052 |
To: comp.lang.java.gui On Sat, 14 Jul 2007 07:10:59 -0700, Oberon <rafal1000@poczta.onet.pl> wrote, quoted or indirectly quoted someone who said : >and on second panel i want to have different objects for each >JComboBox Item :(JSlider, JTable etc) and i dont know how to do this. >I'm beginner in java see http://mindprod.com/jgloss/cardlayout.html -- Roedy Green Canadian Mind Products The Java Glossary http://mindprod.com --- * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet! --- Synchronet 3.15a-Win32 NewsLink 1.92 Time Warp of the Future BBS - telnet://time.synchro.net:24
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.gui
csiph-web