Bringing one JInternalFrame to the front of the JDesktopPane

2004-02-18 Thread Marcos . Rebelo
I'm using one JDesktopPane in my project and I need to set one
JInternalFrame in front of all the other and selected. Until know this is
the better I can do. If the JInternalFrame is iconifyed this don't work. I
know this must be a very simple thing to do but I don't find how. 


import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import javax.swing.JSplitPane;

public class Test {

public static void main(String[] args) {
JFrame frm = new JFrame();
JSplitPane spn = new JSplitPane();
JPanel pnButtons = new JPanel();
final JDesktopPane dsk = new JDesktopPane(); 
final JInternalFrame ifr1 = new
JInternalFrame(1,true,true,true,true);
final JInternalFrame ifr2 = new
JInternalFrame(2,true,true,true,true);  

pnButtons.add(new JButton(new AbstractAction(Open 1){
public void actionPerformed(ActionEvent arg0) {
dsk.getDesktopManager().deiconifyFrame(ifr1);
ifr1.hide();
ifr1.show();
}
}));

pnButtons.add(new JButton(new AbstractAction(Open 2){
public void actionPerformed(ActionEvent arg0) {
dsk.getDesktopManager().deiconifyFrame(ifr2);
ifr2.hide();
ifr2.show();
}
}));


dsk.add(ifr1);
ifr1.pack();
ifr1.setSize(200,100);
ifr1.show();

dsk.add(ifr2);
ifr2.pack();
ifr2.setSize(200,100);
ifr2.show();

spn.setLeftComponent(pnButtons);
spn.setRightComponent(dsk);
frm.setContentPane(spn);
frm.setSize(800, 600);
frm.show();
}
}
___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing


setting colors of only one JComponent instance

2004-02-18 Thread Walthier Mt
Hi List!

How should I set the colors of my JComboBox instance?

The following sets it for all combo:
CODE
UIManager.put(ComboBox.disabledBackground,  Color.red);
UIManager.put(ComboBox.disabledForeground,  Color.green);
UIManager.put(ComboBox.foreground,  Color.magenta);
UIManager.put(ComboBox.selectionBackground,  Color.gray);
UIManager.put(ComboBox.selectionForeground,  Color.pink);
/CODE

So I tought using the next code will do it for me:
(jcbWMTest2 is a JComboBox and I want to alter only this object.)

CODE
jcbWMTest2.putClientProperty(ComboBox.background, Color.cyan);
jcbWMTest2.putClientProperty(ComboBox.disabledBackground,  Color.red);
jcbWMTest2.putClientProperty(ComboBox.disabledForeground,
Color.green);
jcbWMTest2.putClientProperty(ComboBox.foreground,  Color.magenta);
jcbWMTest2.putClientProperty(ComboBox.selectionBackground,
Color.gray);
jcbWMTest2.putClientProperty(ComboBox.selectionForeground,
Color.pink);
/CODE

But it doesn't work! Why? (JAVA SE 1.1.8, Sing 1.1.1)

I know that there is a setBackground/Foreground but it sets the colors in a
too simple way, so the selection, the emply background of the box don't
change from it. Or is it my only solution?

Please help!

Mt

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing


Re: Bringing one JInternalFrame to the front of the JDesktopPane

2004-02-18 Thread Brian Gagne
Calling just the desktop manager method only does part of the job and
leaves the state inconsistent.
This code should fix your problem:  pnButtons.add(new JButton(new AbstractAction("Open 1"){ public void actionPerformed(ActionEvent arg0) {  try { ifr1.setIcon(false); ifr1.setSelected(true); } catch( java.beans.PropertyVetoException e ) {}
  ifr1.toFront(); } })); pnButtons.add(new JButton(new AbstractAction("Open 2"){ public void actionPerformed(ActionEvent arg0) {  try { ifr2.setIcon(false);
 ifr2.setSelected(true); } catch( java.beans.PropertyVetoException e ) {}  ifr2.toFront(); } }));[EMAIL PROTECTED] wrote:
I'm using one JDesktopPane in my project and I need to set oneJInternalFrame in front of all the other and selected. Until know this isthe better I can do. If the JInternalFrame is iconifyed this don't work. Iknow this must be a very simple thing to do but I don't find how. import java.awt.event.ActionEvent;import javax.swing.AbstractAction;import javax.swing.JButton;import javax.swing.JDesktopPane;import javax.swing.JFrame;import javax.swing.JInternalFrame;import javax.swing.JPanel;import javax.swing.JSplitPane;public class Test {public static void main(String[] args) {JFrame frm = new JFrame();JSplitPane spn = new JSplitPane();JPanel pnButtons = new JPanel();final JDesktopPane dsk = new JDesktopPane(); final JInternalFrame ifr1 = newJInternalFrame("1",true,true,true,true);final
 JInternalFrame ifr2 = newJInternalFrame("2",true,true,true,true); pnButtons.add(new JButton(new AbstractAction("Open 1"){public void actionPerformed(ActionEvent arg0) {dsk.getDesktopManager().deiconifyFrame(ifr1);ifr1.hide();ifr1.show();}}));pnButtons.add(new JButton(new AbstractAction("Open 2"){public void actionPerformed(ActionEvent arg0) {dsk.getDesktopManager().deiconifyFrame(ifr2);ifr2.hide();ifr2.show();}}));dsk.add(ifr1);ifr1.pack();ifr1.setSize(200,100);ifr1.show();dsk.add(ifr2);ifr2.pack();ifr2.setSize(200,100);ifr2.show();spn.setLeftComponent(pnButtons);spn.setRightComponent(dsk);frm.setContentPane(spn);frm.setSize(800, 600);frm.show();}}___Advanced-swing mailing list[EMAIL PROTECTED]http://eos.dk/mailman/listinfo/advanced-swing
Do you Yahoo!?
Yahoo! Mail SpamGuard - Read only the mail you want.

Re: listview question.....

2004-02-18 Thread Joe Sam Shirah

Hi Jessamine,

 wondering if java has a ListView fuction similar to that of VB?  

If you want to show rows with columns and headers, then
javax.swing.JTable is the component to use.  If each row is just a single
item that you want users to pick or select from, then javax.swing.JList is
the one, as others have suggested.


 Joe Sam

Joe Sam Shirah -http://www.conceptgo.com
conceptGO -Consulting/Development/Outsourcing
Java Filter Forum:   http://www.ibm.com/developerworks/java/
Just the JDBC FAQs: http://www.jguru.com/faq/JDBC
Going International?http://www.jguru.com/faq/I18N
Que Java400? http://www.jguru.com/faq/Java400


- Original Message -
From: Jessamine [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, February 17, 2004 3:40 AM
Subject: listview question.


 Hi,

 I'm trying to make a java application and I was just
 wondering if java has a ListView fuction similar to
 that of VB?  I've been trying to find some sources in
 the net but have come up with nothing useful.  Would
 anyone know anything about this?

 Thanks,
 Jessamine





___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing


RE: Bringing one JInternalFrame to the front of the JDesktopPane

2004-02-18 Thread Marcos . Rebelo
Thanks, seems to be perfect. 
 
In the end of this work I shall write a book called Tips for real dummy
programmers like me.
 
Thanks
Marcos

-Original Message-
From: Brian Gagne [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 18, 2004 5:19 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: Bringing one JInternalFrame to the front of the JDesktopPane


Calling just the desktop manager method only does part of the job and

leaves the state inconsistent.
This code should fix your problem:
   pnButtons.add(new JButton(new AbstractAction(Open 1){
public void actionPerformed(ActionEvent arg0) {

  try
  {
  ifr1.setIcon(false);
  ifr1.setSelected(true);
  } catch( java.beans.PropertyVetoException e ) {}
 

 
  ifr1.toFront();
}
}));
pnButtons.add(new JButton(new AbstractAction(Open 2){
public void actionPerformed(ActionEvent arg0) {
  
try
{
  ifr2.setIcon(false);
 

 ifr2.setSelected(true);
} catch( java.beans.PropertyVetoException e ) {}

ifr2.toFront();
}
}));


[EMAIL PROTECTED] wrote: 

I'm using one JDesktopPane in my project and I need to set one
JInternalFrame in front of all the other and selected. Until know this is
the better I can do. If the JInternalFrame is iconifyed this don't work. I
know this must be a very simple thing to do but I don't find how. 


import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JDesktopPane;
import javax.swing.JFrame;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
import javax.swing.JSplitPane;

public class Test {

public static void main(String[] args) {
JFrame frm = new JFrame();
JSplitPane spn = new JSplitPane();
JPanel pnButtons = new JPanel();
final JDesktopPane dsk = new JDesktopPane(); 
final JInternalFrame ifr1 = new
JInternalFrame(1,true,true,true,true);
final JInternalFrame ifr2 = new
JInternalFrame(2,true,true,true,true); 

pnButtons.add(new JButton(new AbstractAction(Open 1){
public void actionPerformed(ActionEvent arg0) {
dsk.getDesktopManager().deiconifyFrame(ifr1);
ifr1.hide();
ifr1.show();
}
}));

pnButtons.add(new JButton(new AbstractAction(Open 2){
public void actionPerformed(ActionEvent arg0) {
dsk.getDesktopManager().deiconifyFrame(ifr2);
ifr2.hide();
ifr2.show();
}
}));


dsk.add(ifr1);
ifr1.pack();
ifr1.setSize(200,100);
ifr1.show();

dsk.add(ifr2);
ifr2.pack();
ifr2.setSize(200,100);
ifr2.show();

spn.setLeftComponent(pnButtons);
spn.setRightComponent(dsk);
frm.setContentPane(spn);
frm.setSize(800, 600);
frm.show();
}
}
___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing



  _  

Do you Yahoo!?
Yahoo!
http://us.rd.yahoo.com/mailtag_us/*http://antispam.yahoo.com/tools?tool=1
Mail SpamGuard - Read only the mail you want. 

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing