layout manager doesn't resize controls when I hide a JPanel in applet
I'm working with an applet, and when the user clicks on a label, I do this:
jPanel1.setVisible(false);
contentPane.updateUI();
BTW, contentPane is a JPanel added directly to the JApplet like this: this.add(contentPane, BorderLayout.CENTER);contentPane is using GridBagLayout.
The applet has a number of controls and panels on it
Here is the problem: The panel does get hidden, however the space that the panel consumed is not taken up by the appropriate controls. When the panel is hidden, *no* resizing of any of the controls happens.
I'm using GridBagLayout and do have my wieghts, etc. of the other controls set correctly.
Any help is greatly appreciated.
[709 byte] By [
vintia] at [2007-11-26 19:10:48]

Can you post your code because this sounds very wrong?
Sure thing. Here ya go:
package bcremotecontrol;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import utilities.*;
import javax.swing.ImageIcon;
import java.util.Vector;
import java.net.URL;
import javax.swing.border.*;
/**
*
Title:
*
Description:
*
Copyright: Copyright (c) 2006
*
Company:
* @author not attributable
* @version 1.0
*/
public class BCRemoteControlApplet extends Applet {
private boolean isStandalone = false;
String var0;
//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
//Construct the applet
public BCRemoteControlApplet()
{
}
//Initialize the applet
public void init() {
try {
var0 = this.getParameter("param0", "");
}
catch(Exception e) {
e.printStackTrace();
}
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
boolean kvmCaptured = false;
Vector driveList = new Vector();
Color pressedColor = new Color(128, 255, 128);
Color pressedColorFont = new Color(0, 210, 0);
Color upColor = UIManager.getColor("Button.background");
JPanel contentPane = new JPanel();
GridBagLayout gridBagLayout1 = new GridBagLayout();
JPanel jPanel1 = new JPanel();
GridBagLayout gridBagLayout2 = new GridBagLayout();
JLabel jLabel2 = new JLabel();
JComboBox jComboBox1 = new JComboBox();
JLabel jLabel3 = new JLabel();
JComboBox jComboBox2 = new JComboBox();
JLabel jLabel4 = new JLabel();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JCheckBox jCheckBox1 = new JCheckBox();
JLabel jLabel5 = new JLabel();
JPanel jPanel3 = new JPanel();
JPanel jPanel4 = new JPanel();
GridBagLayout gridBagLayout3 = new GridBagLayout();
JPanel jPanel6 = new JPanel();
FlowLayout flowLayout1 = new FlowLayout();
JToggleButton jToggleButton4 = new JToggleButton();
JToggleButton jToggleButton8 = new JToggleButton();
JToggleButton jToggleButton6 = new JToggleButton();
JToggleButton jToggleButton1 = new JToggleButton();
JToggleButton jToggleButton3 = new JToggleButton();
JToggleButton jToggleButton7 = new JToggleButton();
JToggleButton jToggleButton5 = new JToggleButton();
JToggleButton jToggleButton2 = new JToggleButton();
JLabel jLabel6 = new JLabel();
JComboBox jComboBox3 = new JComboBox();
JScrollPane jScrollPane1 = new JScrollPane();
JList jList1 = new JList();
JLabel jLabel1 = new JLabel();
ImageIcon sectionExpanded = null;
ImageIcon sectionCollapsed = null;
ImageIcon fullScreen = null;
ImageIcon downArrow = null;
JCheckBox jCheckBox2 = new JCheckBox();
JPanel jPanel7 = new JPanel();
FlowLayout flowLayout3 = new FlowLayout();
JLabel jLabel9 = new JLabel();
Border border1;
JPopupMenu jPopupMenu1 = new JPopupMenu();
JMenuItem jMenuItem1 = new JMenuItem();
JMenuItem jMenuItem2 = new JMenuItem();
JMenuItem jMenuItem3 = new JMenuItem();
BorderLayout borderLayout1 = new BorderLayout();
JMenuItem jMenuItem4 = new JMenuItem();
JPopupMenu jPopupMenu2 = new JPopupMenu();
JMenuItem jMenuItem5 = new JMenuItem();
JMenuItem jMenuItem6 = new JMenuItem();
JMenuItem jMenuItem7 = new JMenuItem();
JButton jButton3 = new JButton();
JButton jButton4 = new JButton();
JPanel jPanel2 = new JPanel();
FlowLayout flowLayout2 = new FlowLayout();
//Component initialization
private void jbInit() throws Exception {
border1 = BorderFactory.createLineBorder(Color.lightGray,1);
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
contentPane.setLayout(gridBagLayout1);
this.setSize(new Dimension(820, 523));
this.setLayout(borderLayout1);
contentPane.setBorder(border1);
contentPane.setMinimumSize(new Dimension(400, 386));
contentPane.setOpaque(true);
contentPane.setPreferredSize(new Dimension(800, 600));
jPanel1.setMinimumSize(new Dimension(400, 166));
jPanel1.setOpaque(true);
jPanel1.setPreferredSize(new Dimension(200, 175));
jPanel1.setLayout(gridBagLayout2);
jLabel2.setMaximumSize(new Dimension(130, 15));
jLabel2.setText("Chassis media tray owner:");
jComboBox1.setMinimumSize(new Dimension(150, 19));
jComboBox1.setPreferredSize(new Dimension(150, 19));
jLabel3.setText("Mount remote media to:");
jComboBox2.setMinimumSize(new Dimension(150, 19));
jComboBox2.setPreferredSize(new Dimension(150, 19));
jLabel4.setToolTipText("");
jLabel4.setText("Mounted drives and images:");
jButton1.setHorizontalAlignment(SwingConstants.CENTER);
jButton1.setHorizontalTextPosition(SwingConstants.LEADING);
jButton1.setText("Add Media");
jButton1.addActionListener(new BCRemoteControlApplet_jButton1_actionAdapter(this));
jButton2.setText("Remove");
jButton2.addActionListener(new BCRemoteControlApplet_jButton2_actionAdapter(this));
jCheckBox1.setText("Write protect all drives and images");
jLabel5.setFont(new java.awt.Font("Dialog", 1, 14));
jLabel5.setText("Remote Console");
jLabel5.addMouseListener(new BCRemoteControlApplet_jLabel5_mouseAdapter(this));
jPanel3.setBackground(Color.white);
jPanel3.setPreferredSize(new Dimension(10, 350));
jPanel3.addMouseListener(new BCRemoteControlApplet_jPanel3_mouseAdapter(this));
jPanel4.setAlignmentY((float) 0.5);
jPanel4.setMinimumSize(new Dimension(10, 90));
jPanel4.setOpaque(true);
jPanel4.setPreferredSize(new Dimension(10, 90));
jPanel4.setLayout(gridBagLayout3);
jPanel6.setBorder(null);
jPanel6.setMinimumSize(new Dimension(10, 35));
jPanel6.setPreferredSize(new Dimension(10, 35));
jPanel6.setLayout(flowLayout1);
jToggleButton4.setText("F1");
jToggleButton8.setText("Scroll Lock");
jToggleButton6.setText("Caps Lock");
jToggleButton1.setText("Ctrl");
jToggleButton1.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton2.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton3.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton4.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton5.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton6.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton7.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton8.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton3.setText("Tab");
jToggleButton7.setText("Num Lock");
jToggleButton5.setText("Insert");
jToggleButton2.setText("Alt");
jLabel6.setText("Current target system:");
jComboBox3.setMinimumSize(new Dimension(150, 19));
jComboBox3.setPreferredSize(new Dimension(150, 19));
flowLayout1.setAlignment(FlowLayout.LEFT);
flowLayout1.setHgap(5);
flowLayout1.setVgap(5);
jScrollPane1.setMinimumSize(new Dimension(350, 50));
jScrollPane1.setPreferredSize(new Dimension(350, 50));
jLabel1.setFont(new java.awt.Font("Dialog", 1, 14));
jLabel1.setText("Remote Media");
jLabel1.addMouseListener(new BCRemoteControlApplet_jLabel1_mouseAdapter(this));
jList1.addListSelectionListener(new BCRemoteControlApplet_jList1_listSelectionAdapter(this));
jCheckBox2.setToolTipText("Scales the remote system screen to fit in this window");
jCheckBox2.setText("Fit to Window");
jCheckBox2.addItemListener(new BCRemoteControlApplet_jCheckBox2_itemAdapter(this));
jPanel7.setPreferredSize(new Dimension(250, 25));
jPanel7.setLayout(flowLayout3);
flowLayout3.setAlignment(FlowLayout.LEFT);
jLabel9.setFont(new java.awt.Font("Dialog", 0, 11));
jLabel9.setForeground(Color.black);
jLabel9.setOpaque(true);
jLabel9.setText("<html>Remote system: (Click in the area below to transfer KVM control to the remote system)</html>");
jLabel9.addMouseListener(new BCRemoteControlApplet_jLabel9_mouseAdapter(this));
jMenuItem1.setText("CD ROM Drive (D:\\)");
jMenuItem1.addMouseListener(new BCRemoteControlApplet_jMenuItem1_mouseAdapter(this));
jMenuItem1.addItemListener(new BCRemoteControlApplet_jMenuItem1_itemAdapter(this));
jMenuItem2.setText("Mount Local Disk Image. . .");
jMenuItem3.setText("Upload Disk Image to AMM (64 MB available). . .");
jMenuItem4.setText("Floppy Drive (A:\\)");
jMenuItem5.setText("Add/Remove. . .");
jMenuItem5.addActionListener(new BCRemoteControlApplet_jMenuItem5_actionAdapter(this));
jMenuItem6.setText("Ctrl + Alt + Del");
jMenuItem7.setText("Alt + Tab");
jButton3.setHorizontalTextPosition(SwingConstants.LEADING);
jButton3.setText("Custom");
jButton3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
jButton3.addActionListener(new BCRemoteControlApplet_jButton3_actionAdapter(this));
jButton4.setHorizontalTextPosition(SwingConstants.LEADING);
jButton4.setText("Full Screen");
jButton4.addActionListener(new BCRemoteControlApplet_jButton4_actionAdapter(this));
jPanel2.setMinimumSize(new Dimension(20, 33));
jPanel2.setPreferredSize(new Dimension(20, 33));
jPanel2.setLayout(flowLayout2);
flowLayout2.setAlignment(FlowLayout.RIGHT);
this.add(contentPane, BorderLayout.CENTER);
contentPane.add(jPanel1,new GridBagConstraints(0, 2, 3, 1, 1.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
jPanel1.add(jLabel2,new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jComboBox1,new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jLabel3,new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
jPanel1.add(jComboBox2,new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jLabel4,new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
jPanel1.add(jButton1, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(1, 3, 0, 200), 0, 0));
jPanel1.add(jButton2, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(3, 3, 0, 200), 0, 0));
jPanel1.add(jCheckBox1,new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jScrollPane1,new GridBagConstraints(0, 5, 1, 2, 0.65, 1.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
jScrollPane1.getViewport().add(jList1, null);
contentPane.add(jLabel5,new GridBagConstraints(0, 3, 3, 1, 1.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 3, 0, 0), 0, 0));
contentPane.add(jPanel3, new GridBagConstraints(0, 6, 3, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
contentPane.add(jPanel4,new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel4.add(jPanel6,new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel6.add(jButton3, null);
jPanel6.add(jToggleButton1, null);
jPanel6.add(jToggleButton2, null);
jPanel6.add(jToggleButton3, null);
jPanel6.add(jToggleButton4, null);
jPanel6.add(jToggleButton5, null);
jPanel6.add(jToggleButton7, null);
jPanel6.add(jToggleButton8, null);
jPanel6.add(jToggleButton6, null);
jPanel4.add(jLabel6,new GridBagConstraints(0, 1, 3, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 3, 0, 0), 0, 0));
jPanel4.add(jComboBox3,new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 3, 0, 0), 0, 0));
jPanel4.add(jCheckBox2,new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 20, 0, 0), 0, 0));
contentPane.add(jPanel7, new GridBagConstraints(0, 1, 3, 1, 1.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
contentPane.add(jPanel7,new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel7.add(jLabel1);
contentPane.add(jLabel9,new GridBagConstraints(0, 5, 3, 1, 1.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 1, 0, 1), 0, 0));
jPanel2.add(jButton4, null);
contentPane.add(jPanel2, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPopupMenu1.add(jMenuItem1);
jPopupMenu1.add(jMenuItem4);
jPopupMenu1.add(jMenuItem2);
jPopupMenu1.add(jMenuItem3);
jPopupMenu2.add(jMenuItem5);
jPopupMenu2.addSeparator();
jPopupMenu2.add(jMenuItem6);
jPopupMenu2.add(jMenuItem7);
jComboBox1.addItem("Blade 1");
jComboBox1.addItem("Blade 2");
jComboBox1.addItem("Blade 3");
jComboBox2.addItem("Blade 1");
jComboBox2.addItem("Blade 2");
jComboBox2.addItem("Blade 3");
jComboBox1.setSelectedIndex(-1);
jComboBox2.setSelectedIndex(-1);
Cursor pointer = new Cursor(Cursor.HAND_CURSOR);
jComboBox3.addItem("Blade 1");
jComboBox3.addItem("Blade 2");
jComboBox3.addItem("Blade 3");
jComboBox3.setSelectedIndex(-1);
URL imgURLExp = BCRemoteControlApplet.class.getResource("images/TreeExpandedMinus.gif");
URL imgURLCol = BCRemoteControlApplet.class.getResource("images/TreeCollapsedPlus.gif");
URL imgURLDown = BCRemoteControlApplet.class.getResource("images/DownOne.gif");
URL imgURLFullScreen = BCRemoteControlApplet.class.getResource("images/fullscreen1.gif");
sectionExpanded = utilities.IconUtilities.createImageIcon(imgURLExp, "");
sectionCollapsed = utilities.IconUtilities.createImageIcon(imgURLCol, "");
downArrow = utilities.IconUtilities.createImageIcon(imgURLDown, "");
fullScreen = utilities.IconUtilities.createImageIcon(imgURLFullScreen, "");
//jLabel1.setIcon(sectionExpanded);
//jLabel1.setCursor(pointer);
//jLabel5.setIcon(sectionExpanded);
//jLabel5.setCursor(pointer);
jList1.setListData(driveList);
jButton1.setIcon(downArrow);
jButton3.setIcon(downArrow);
// jLabel9.setVisible(false);
jButton4.setIcon(fullScreen);
this.setBackground(UIManager.getColor("Button.background"));
}
void doKvmCapture()
{
kvmCaptured = !kvmCaptured;
if (kvmCaptured)
{
jLabel9.setText("<html>Mouse and keyboard are now captured by the remote system. Press the left Alt key to release control</html>");
jLabel9.setForeground(Color.white);
jLabel9.setBackground(Color.blue);
jLabel9.setOpaque(true);
jLabel9.setFont(new java.awt.Font("Dialog", 1, 11));
jPanel3.setBorder(BorderFactory.createLineBorder(Color.blue));
}
else
{
jLabel9.setText("<html>Remote system: (Click in the area below to transfer KVM control to the remote system)</html>");
jLabel9.setForeground(Color.black);
jLabel9.setFont(new java.awt.Font("Dialog", 0, 11));
jLabel9.setOpaque(false);
jPanel3.setBorder(null);
}
}
void jButton1_actionPerformed(ActionEvent e)
{
jPopupMenu1.show(jButton1,
0,
jButton1.getHeight() + 2
);
/*
Dialog_adddisk dlgAddDisk = new Dialog_adddisk();
dlgAddDisk.pack();
dlgAddDisk.setTitle("Attach Local Disk or Drive");
dlgAddDisk.setModal(true);
//Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = dlgAddDisk.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
dlgAddDisk.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
dlgAddDisk.show();
if (dlgAddDisk.jRadioButton1.isSelected())
driveList.addElement(dlgAddDisk.jComboBox1.getSelectedItem().toString());
if (dlgAddDisk.jRadioButton2.isSelected())
driveList.addElement(dlgAddDisk.jTextField1.getText());
jList1.updateUI();
*/
}
void jToggleButton1_stateChanged(ChangeEvent e)
{
JToggleButton src = (JToggleButton)(e.getSource());
// System.out.println(src.toString());
if (src.isSelected())
{
src.setBackground(pressedColor);
//src.setForeground(pressedColorFont);
src.setForeground(Color.blue);
src.setFont(new java.awt.Font("Dialog", 1, 11));
}
else
{
src.setBackground(upColor);
src.setForeground(Color.darkGray);
src.setFont(new java.awt.Font("Dialog", 0, 11));
}
// System.out.println(src.isSelected());
}
void jLabel1_mouseClicked(MouseEvent e)
{
}
void jLabel5_mouseClicked(MouseEvent e)
{
}
void jButton2_actionPerformed(ActionEvent e)
{
if (jList1.getSelectedIndex() < 0) return;
driveList.removeElementAt(jList1.getSelectedIndex());
jList1.updateUI();
}
void jList1_valueChanged(ListSelectionEvent e)
{
jButton2.setEnabled(jList1.getSelectedIndex() > -1);
}
void jPanel3_mouseClicked(MouseEvent e)
{
if (!kvmCaptured)
{
doKvmCapture();
}
}
void jLabel9_mouseClicked(MouseEvent e)
{
doKvmCapture();
}
void jToggleButton1_actionPerformed(ActionEvent e) {
}
void jMenuItem1_itemStateChanged(ItemEvent e) {
}
void jMenuItem1_mouseClicked(MouseEvent e)
{
driveList.addElement(jMenuItem1.getText());
jList1.updateUI();
}
void jCheckBox2_itemStateChanged(ItemEvent e)
{
}
void jMenuItem5_actionPerformed(ActionEvent e)
{
KeyComboDialog dlg = new KeyComboDialog();
dlg.pack();
dlg.setModal(true);
//Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = dlg.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
dlg.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
dlg.show();
}
void jButton3_actionPerformed(ActionEvent e)
{
jPopupMenu2.show(jButton3,
0,
jButton3.getHeight() + 2
);
}
void jButton4_actionPerformed(ActionEvent e)
{
//boolean visible = jPanel4.isVisible();
//jPanel3.setVisible(!visible);
//jPanel4.setVisible(!visible);
//contentPane.updateUI();
//jPanel3.revalidate();
//boolean visible = jPanel1.isVisible();
//jPanel1.setVisible(!visible);
//jLabel7.setVisible(!(jPanel1.isVisible()));
//contentPane.updateUI();
}
}
class BCRemoteControlApplet_jButton1_actionAdapter implements java.awt.event.ActionListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jButton1_actionAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
class BCRemoteControlApplet_jToggleButton1_changeAdapter implements javax.swing.event.ChangeListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jToggleButton1_changeAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void stateChanged(ChangeEvent e) {
adaptee.jToggleButton1_stateChanged(e);
}
}
class BCRemoteControlApplet_jLabel1_mouseAdapter extends java.awt.event.MouseAdapter {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jLabel1_mouseAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void mouseClicked(MouseEvent e) {
adaptee.jLabel1_mouseClicked(e);
}
}
class BCRemoteControlApplet_jLabel5_mouseAdapter extends java.awt.event.MouseAdapter {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jLabel5_mouseAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void mouseClicked(MouseEvent e) {
adaptee.jLabel5_mouseClicked(e);
}
}
class BCRemoteControlApplet_jButton2_actionAdapter implements java.awt.event.ActionListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jButton2_actionAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
class BCRemoteControlApplet_jList1_listSelectionAdapter implements javax.swing.event.ListSelectionListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jList1_listSelectionAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void valueChanged(ListSelectionEvent e) {
adaptee.jList1_valueChanged(e);
}
}
class BCRemoteControlApplet_jPanel3_mouseAdapter extends java.awt.event.MouseAdapter {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jPanel3_mouseAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void mouseClicked(MouseEvent e) {
adaptee.jPanel3_mouseClicked(e);
}
}
class BCRemoteControlApplet_jLabel9_mouseAdapter extends java.awt.event.MouseAdapter {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jLabel9_mouseAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void mouseClicked(MouseEvent e) {
adaptee.jLabel9_mouseClicked(e);
}
}
class BCRemoteControlApplet_jMenuItem1_itemAdapter implements java.awt.event.ItemListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jMenuItem1_itemAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void itemStateChanged(ItemEvent e) {
adaptee.jMenuItem1_itemStateChanged(e);
}
}
class BCRemoteControlApplet_jMenuItem1_mouseAdapter extends java.awt.event.MouseAdapter {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jMenuItem1_mouseAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void mouseClicked(MouseEvent e) {
adaptee.jMenuItem1_mouseClicked(e);
}
}
class BCRemoteControlApplet_jCheckBox2_itemAdapter implements java.awt.event.ItemListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jCheckBox2_itemAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void itemStateChanged(ItemEvent e) {
adaptee.jCheckBox2_itemStateChanged(e);
}
}
class BCRemoteControlApplet_jMenuItem5_actionAdapter implements java.awt.event.ActionListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jMenuItem5_actionAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem5_actionPerformed(e);
}
}
class BCRemoteControlApplet_jButton3_actionAdapter implements java.awt.event.ActionListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jButton3_actionAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton3_actionPerformed(e);
}
}
class BCRemoteControlApplet_jButton4_actionAdapter implements java.awt.event.ActionListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jButton4_actionAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton4_actionPerformed(e);
}
}
> Can you post your code because this sounds very wrong?
Shoot, I should have previewed that last one. Here is a better formatted version:
package bcremotecontrol;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import utilities.*;
import javax.swing.ImageIcon;
import java.util.Vector;
import java.net.URL;
import javax.swing.border.*;
/**
*
Title:
*
Description:
*
Copyright: Copyright (c) 2006
*
Company:
* @author not attributable
* @version 1.0
*/
public class BCRemoteControlApplet extends Applet {
private boolean isStandalone = false;
String var0;
//Get a parameter value
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
//Construct the applet
public BCRemoteControlApplet()
{
}
//Initialize the applet
public void init() {
try {
var0 = this.getParameter("param0", "");
}
catch(Exception e) {
e.printStackTrace();
}
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
boolean kvmCaptured = false;
Vector driveList = new Vector();
Color pressedColor = new Color(128, 255, 128);
Color pressedColorFont = new Color(0, 210, 0);
Color upColor = UIManager.getColor("Button.background");
JPanel contentPane = new JPanel();
GridBagLayout gridBagLayout1 = new GridBagLayout();
JPanel jPanel1 = new JPanel();
GridBagLayout gridBagLayout2 = new GridBagLayout();
JLabel jLabel2 = new JLabel();
JComboBox jComboBox1 = new JComboBox();
JLabel jLabel3 = new JLabel();
JComboBox jComboBox2 = new JComboBox();
JLabel jLabel4 = new JLabel();
JButton jButton1 = new JButton();
JButton jButton2 = new JButton();
JCheckBox jCheckBox1 = new JCheckBox();
JLabel jLabel5 = new JLabel();
JPanel jPanel3 = new JPanel();
JPanel jPanel4 = new JPanel();
GridBagLayout gridBagLayout3 = new GridBagLayout();
JPanel jPanel6 = new JPanel();
FlowLayout flowLayout1 = new FlowLayout();
JToggleButton jToggleButton4 = new JToggleButton();
JToggleButton jToggleButton8 = new JToggleButton();
JToggleButton jToggleButton6 = new JToggleButton();
JToggleButton jToggleButton1 = new JToggleButton();
JToggleButton jToggleButton3 = new JToggleButton();
JToggleButton jToggleButton7 = new JToggleButton();
JToggleButton jToggleButton5 = new JToggleButton();
JToggleButton jToggleButton2 = new JToggleButton();
JLabel jLabel6 = new JLabel();
JComboBox jComboBox3 = new JComboBox();
JScrollPane jScrollPane1 = new JScrollPane();
JList jList1 = new JList();
JLabel jLabel1 = new JLabel();
ImageIcon sectionExpanded = null;
ImageIcon sectionCollapsed = null;
ImageIcon fullScreen = null;
ImageIcon downArrow = null;
JCheckBox jCheckBox2 = new JCheckBox();
JPanel jPanel7 = new JPanel();
FlowLayout flowLayout3 = new FlowLayout();
JLabel jLabel9 = new JLabel();
Border border1;
JPopupMenu jPopupMenu1 = new JPopupMenu();
JMenuItem jMenuItem1 = new JMenuItem();
JMenuItem jMenuItem2 = new JMenuItem();
JMenuItem jMenuItem3 = new JMenuItem();
BorderLayout borderLayout1 = new BorderLayout();
JMenuItem jMenuItem4 = new JMenuItem();
JPopupMenu jPopupMenu2 = new JPopupMenu();
JMenuItem jMenuItem5 = new JMenuItem();
JMenuItem jMenuItem6 = new JMenuItem();
JMenuItem jMenuItem7 = new JMenuItem();
JButton jButton3 = new JButton();
JButton jButton4 = new JButton();
JPanel jPanel2 = new JPanel();
FlowLayout flowLayout2 = new FlowLayout();
//Component initialization
private void jbInit() throws Exception {
border1 = BorderFactory.createLineBorder(Color.lightGray,1);
//UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
contentPane.setLayout(gridBagLayout1);
this.setSize(new Dimension(820, 523));
this.setLayout(borderLayout1);
contentPane.setBorder(border1);
contentPane.setMinimumSize(new Dimension(400, 386));
contentPane.setOpaque(true);
contentPane.setPreferredSize(new Dimension(800, 600));
jPanel1.setMinimumSize(new Dimension(400, 166));
jPanel1.setOpaque(true);
jPanel1.setPreferredSize(new Dimension(200, 175));
jPanel1.setLayout(gridBagLayout2);
jLabel2.setMaximumSize(new Dimension(130, 15));
jLabel2.setText("Chassis media tray owner:");
jComboBox1.setMinimumSize(new Dimension(150, 19));
jComboBox1.setPreferredSize(new Dimension(150, 19));
jLabel3.setText("Mount remote media to:");
jComboBox2.setMinimumSize(new Dimension(150, 19));
jComboBox2.setPreferredSize(new Dimension(150, 19));
jLabel4.setToolTipText("");
jLabel4.setText("Mounted drives and images:");
jButton1.setHorizontalAlignment(SwingConstants.CENTER);
jButton1.setHorizontalTextPosition(SwingConstants.LEADING);
jButton1.setText("Add Media");
jButton1.addActionListener(new BCRemoteControlApplet_jButton1_actionAdapter(this));
jButton2.setText("Remove");
jButton2.addActionListener(new BCRemoteControlApplet_jButton2_actionAdapter(this));
jCheckBox1.setText("Write protect all drives and images");
jLabel5.setFont(new java.awt.Font("Dialog", 1, 14));
jLabel5.setText("Remote Console");
jLabel5.addMouseListener(new BCRemoteControlApplet_jLabel5_mouseAdapter(this));
jPanel3.setBackground(Color.white);
jPanel3.setPreferredSize(new Dimension(10, 350));
jPanel3.addMouseListener(new BCRemoteControlApplet_jPanel3_mouseAdapter(this));
jPanel4.setAlignmentY((float) 0.5);
jPanel4.setMinimumSize(new Dimension(10, 90));
jPanel4.setOpaque(true);
jPanel4.setPreferredSize(new Dimension(10, 90));
jPanel4.setLayout(gridBagLayout3);
jPanel6.setBorder(null);
jPanel6.setMinimumSize(new Dimension(10, 35));
jPanel6.setPreferredSize(new Dimension(10, 35));
jPanel6.setLayout(flowLayout1);
jToggleButton4.setText("F1");
jToggleButton8.setText("Scroll Lock");
jToggleButton6.setText("Caps Lock");
jToggleButton1.setText("Ctrl");
jToggleButton1.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton2.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton3.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton4.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton5.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton6.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton7.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton8.addChangeListener(new BCRemoteControlApplet_jToggleButton1_changeAdapter(this));
jToggleButton3.setText("Tab");
jToggleButton7.setText("Num Lock");
jToggleButton5.setText("Insert");
jToggleButton2.setText("Alt");
jLabel6.setText("Current target system:");
jComboBox3.setMinimumSize(new Dimension(150, 19));
jComboBox3.setPreferredSize(new Dimension(150, 19));
flowLayout1.setAlignment(FlowLayout.LEFT);
flowLayout1.setHgap(5);
flowLayout1.setVgap(5);
jScrollPane1.setMinimumSize(new Dimension(350, 50));
jScrollPane1.setPreferredSize(new Dimension(350, 50));
jLabel1.setFont(new java.awt.Font("Dialog", 1, 14));
jLabel1.setText("Remote Media");
jLabel1.addMouseListener(new BCRemoteControlApplet_jLabel1_mouseAdapter(this));
jList1.addListSelectionListener(new BCRemoteControlApplet_jList1_listSelectionAdapter(this));
jCheckBox2.setToolTipText("Scales the remote system screen to fit in this window");
jCheckBox2.setText("Fit to Window");
jCheckBox2.addItemListener(new BCRemoteControlApplet_jCheckBox2_itemAdapter(this));
jPanel7.setPreferredSize(new Dimension(250, 25));
jPanel7.setLayout(flowLayout3);
flowLayout3.setAlignment(FlowLayout.LEFT);
jLabel9.setFont(new java.awt.Font("Dialog", 0, 11));
jLabel9.setForeground(Color.black);
jLabel9.setOpaque(true);
jLabel9.setText("<html>Remote system: (Click in the area below to transfer KVM control to the remote system)</html>");
jLabel9.addMouseListener(new BCRemoteControlApplet_jLabel9_mouseAdapter(this));
jMenuItem1.setText("CD ROM Drive (D:\\)");
jMenuItem1.addMouseListener(new BCRemoteControlApplet_jMenuItem1_mouseAdapter(this));
jMenuItem1.addItemListener(new BCRemoteControlApplet_jMenuItem1_itemAdapter(this));
jMenuItem2.setText("Mount Local Disk Image. . .");
jMenuItem3.setText("Upload Disk Image to AMM (64 MB available). . .");
jMenuItem4.setText("Floppy Drive (A:\\)");
jMenuItem5.setText("Add/Remove. . .");
jMenuItem5.addActionListener(new BCRemoteControlApplet_jMenuItem5_actionAdapter(this));
jMenuItem6.setText("Ctrl + Alt + Del");
jMenuItem7.setText("Alt + Tab");
jButton3.setHorizontalTextPosition(SwingConstants.LEADING);
jButton3.setText("Custom");
jButton3.setVerticalTextPosition(javax.swing.SwingConstants.CENTER);
jButton3.addActionListener(new BCRemoteControlApplet_jButton3_actionAdapter(this));
jButton4.setHorizontalTextPosition(SwingConstants.LEADING);
jButton4.setText("Full Screen");
jButton4.addActionListener(new BCRemoteControlApplet_jButton4_actionAdapter(this));
jPanel2.setMinimumSize(new Dimension(20, 33));
jPanel2.setPreferredSize(new Dimension(20, 33));
jPanel2.setLayout(flowLayout2);
flowLayout2.setAlignment(FlowLayout.RIGHT);
this.add(contentPane, BorderLayout.CENTER);
contentPane.add(jPanel1,new GridBagConstraints(0, 2, 3, 1, 1.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 0, 5), 0, 0));
jPanel1.add(jLabel2,new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jComboBox1,new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jLabel3,new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
jPanel1.add(jComboBox2,new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jLabel4,new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 0, 0, 0), 0, 0));
jPanel1.add(jButton1, new GridBagConstraints(1, 5, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(1, 3, 0, 200), 0, 0));
jPanel1.add(jButton2, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(3, 3, 0, 200), 0, 0));
jPanel1.add(jCheckBox1,new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel1.add(jScrollPane1,new GridBagConstraints(0, 5, 1, 2, 0.65, 1.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
jScrollPane1.getViewport().add(jList1, null);
contentPane.add(jLabel5,new GridBagConstraints(0, 3, 3, 1, 1.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(5, 3, 0, 0), 0, 0));
contentPane.add(jPanel3, new GridBagConstraints(0, 6, 3, 1, 1.0, 1.0
,GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
contentPane.add(jPanel4,new GridBagConstraints(0, 4, 3, 1, 1.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel4.add(jPanel6,new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPanel6.add(jButton3, null);
jPanel6.add(jToggleButton1, null);
jPanel6.add(jToggleButton2, null);
jPanel6.add(jToggleButton3, null);
jPanel6.add(jToggleButton4, null);
jPanel6.add(jToggleButton5, null);
jPanel6.add(jToggleButton7, null);
jPanel6.add(jToggleButton8, null);
jPanel6.add(jToggleButton6, null);
jPanel4.add(jLabel6,new GridBagConstraints(0, 1, 3, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 3, 0, 0), 0, 0));
jPanel4.add(jComboBox3,new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 3, 0, 0), 0, 0));
jPanel4.add(jCheckBox2,new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 20, 0, 0), 0, 0));
contentPane.add(jPanel7, new GridBagConstraints(0, 1, 3, 1, 1.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
contentPane.add(jPanel7,new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
jPanel7.add(jLabel1);
contentPane.add(jLabel9,new GridBagConstraints(0, 5, 3, 1, 1.0, 0.0
,GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 1, 0, 1), 0, 0));
jPanel2.add(jButton4, null);
contentPane.add(jPanel2, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0
,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
jPopupMenu1.add(jMenuItem1);
jPopupMenu1.add(jMenuItem4);
jPopupMenu1.add(jMenuItem2);
jPopupMenu1.add(jMenuItem3);
jPopupMenu2.add(jMenuItem5);
jPopupMenu2.addSeparator();
jPopupMenu2.add(jMenuItem6);
jPopupMenu2.add(jMenuItem7);
jComboBox1.addItem("Blade 1");
jComboBox1.addItem("Blade 2");
jComboBox1.addItem("Blade 3");
jComboBox2.addItem("Blade 1");
jComboBox2.addItem("Blade 2");
jComboBox2.addItem("Blade 3");
jComboBox1.setSelectedIndex(-1);
jComboBox2.setSelectedIndex(-1);
Cursor pointer = new Cursor(Cursor.HAND_CURSOR);
jComboBox3.addItem("Blade 1");
jComboBox3.addItem("Blade 2");
jComboBox3.addItem("Blade 3");
jComboBox3.setSelectedIndex(-1);
URL imgURLExp = BCRemoteControlApplet.class.getResource("images/TreeExpandedMinus.gif");
URL imgURLCol = BCRemoteControlApplet.class.getResource("images/TreeCollapsedPlus.gif");
URL imgURLDown = BCRemoteControlApplet.class.getResource("images/DownOne.gif");
URL imgURLFullScreen = BCRemoteControlApplet.class.getResource("images/fullscreen1.gif");
sectionExpanded = utilities.IconUtilities.createImageIcon(imgURLExp, "");
sectionCollapsed = utilities.IconUtilities.createImageIcon(imgURLCol, "");
downArrow = utilities.IconUtilities.createImageIcon(imgURLDown, "");
fullScreen = utilities.IconUtilities.createImageIcon(imgURLFullScreen, "");
//jLabel1.setIcon(sectionExpanded);
//jLabel1.setCursor(pointer);
//jLabel5.setIcon(sectionExpanded);
//jLabel5.setCursor(pointer);
jList1.setListData(driveList);
jButton1.setIcon(downArrow);
jButton3.setIcon(downArrow);
// jLabel9.setVisible(false);
jButton4.setIcon(fullScreen);
this.setBackground(UIManager.getColor("Button.background"));
}
void doKvmCapture()
{
kvmCaptured = !kvmCaptured;
if (kvmCaptured)
{
jLabel9.setText("<html>Mouse and keyboard are now captured by the remote system. Press the left Alt key to release control</html>");
jLabel9.setForeground(Color.white);
jLabel9.setBackground(Color.blue);
jLabel9.setOpaque(true);
jLabel9.setFont(new java.awt.Font("Dialog", 1, 11));
jPanel3.setBorder(BorderFactory.createLineBorder(Color.blue));
}
else
{
jLabel9.setText("<html>Remote system: (Click in the area below to transfer KVM control to the remote system)</html>");
jLabel9.setForeground(Color.black);
jLabel9.setFont(new java.awt.Font("Dialog", 0, 11));
jLabel9.setOpaque(false);
jPanel3.setBorder(null);
}
}
void jButton1_actionPerformed(ActionEvent e)
{
jPopupMenu1.show(jButton1,
0,
jButton1.getHeight() + 2
);
/*
Dialog_adddisk dlgAddDisk = new Dialog_adddisk();
dlgAddDisk.pack();
dlgAddDisk.setTitle("Attach Local Disk or Drive");
dlgAddDisk.setModal(true);
//Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = dlgAddDisk.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
dlgAddDisk.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
dlgAddDisk.show();
if (dlgAddDisk.jRadioButton1.isSelected())
driveList.addElement(dlgAddDisk.jComboBox1.getSelectedItem().toString());
if (dlgAddDisk.jRadioButton2.isSelected())
driveList.addElement(dlgAddDisk.jTextField1.getText());
jList1.updateUI();
*/
}
void jToggleButton1_stateChanged(ChangeEvent e)
{
JToggleButton src = (JToggleButton)(e.getSource());
// System.out.println(src.toString());
if (src.isSelected())
{
src.setBackground(pressedColor);
//src.setForeground(pressedColorFont);
src.setForeground(Color.blue);
src.setFont(new java.awt.Font("Dialog", 1, 11));
}
else
{
src.setBackground(upColor);
src.setForeground(Color.darkGray);
src.setFont(new java.awt.Font("Dialog", 0, 11));
}
// System.out.println(src.isSelected());
}
void jLabel1_mouseClicked(MouseEvent e)
{
}
void jLabel5_mouseClicked(MouseEvent e)
{
}
void jButton2_actionPerformed(ActionEvent e)
{
if (jList1.getSelectedIndex() < 0) return;
driveList.removeElementAt(jList1.getSelectedIndex());
jList1.updateUI();
}
void jList1_valueChanged(ListSelectionEvent e)
{
jButton2.setEnabled(jList1.getSelectedIndex() > -1);
}
void jPanel3_mouseClicked(MouseEvent e)
{
if (!kvmCaptured)
{
doKvmCapture();
}
}
void jLabel9_mouseClicked(MouseEvent e)
{
doKvmCapture();
}
void jToggleButton1_actionPerformed(ActionEvent e) {
}
void jMenuItem1_itemStateChanged(ItemEvent e) {
}
void jMenuItem1_mouseClicked(MouseEvent e)
{
driveList.addElement(jMenuItem1.getText());
jList1.updateUI();
}
void jCheckBox2_itemStateChanged(ItemEvent e)
{
}
void jMenuItem5_actionPerformed(ActionEvent e)
{
KeyComboDialog dlg = new KeyComboDialog();
dlg.pack();
dlg.setModal(true);
//Center the window
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize = dlg.getSize();
if (frameSize.height > screenSize.height) {
frameSize.height = screenSize.height;
}
if (frameSize.width > screenSize.width) {
frameSize.width = screenSize.width;
}
dlg.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
dlg.show();
}
void jButton3_actionPerformed(ActionEvent e)
{
jPopupMenu2.show(jButton3,
0,
jButton3.getHeight() + 2
);
}
void jButton4_actionPerformed(ActionEvent e)
{
//boolean visible = jPanel4.isVisible();
//jPanel3.setVisible(!visible);
//jPanel4.setVisible(!visible);
//contentPane.updateUI();
//jPanel3.revalidate();
//boolean visible = jPanel1.isVisible();
//jPanel1.setVisible(!visible);
//jLabel7.setVisible(!(jPanel1.isVisible()));
//contentPane.updateUI();
}
}
class BCRemoteControlApplet_jButton1_actionAdapter implements java.awt.event.ActionListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jButton1_actionAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton1_actionPerformed(e);
}
}
class BCRemoteControlApplet_jToggleButton1_changeAdapter implements javax.swing.event.ChangeListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jToggleButton1_changeAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void stateChanged(ChangeEvent e) {
adaptee.jToggleButton1_stateChanged(e);
}
}
class BCRemoteControlApplet_jLabel1_mouseAdapter extends java.awt.event.MouseAdapter {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jLabel1_mouseAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void mouseClicked(MouseEvent e) {
adaptee.jLabel1_mouseClicked(e);
}
}
class BCRemoteControlApplet_jLabel5_mouseAdapter extends java.awt.event.MouseAdapter {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jLabel5_mouseAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void mouseClicked(MouseEvent e) {
adaptee.jLabel5_mouseClicked(e);
}
}
class BCRemoteControlApplet_jButton2_actionAdapter implements java.awt.event.ActionListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jButton2_actionAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton2_actionPerformed(e);
}
}
class BCRemoteControlApplet_jList1_listSelectionAdapter implements javax.swing.event.ListSelectionListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jList1_listSelectionAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void valueChanged(ListSelectionEvent e) {
adaptee.jList1_valueChanged(e);
}
}
class BCRemoteControlApplet_jPanel3_mouseAdapter extends java.awt.event.MouseAdapter {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jPanel3_mouseAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void mouseClicked(MouseEvent e) {
adaptee.jPanel3_mouseClicked(e);
}
}
class BCRemoteControlApplet_jLabel9_mouseAdapter extends java.awt.event.MouseAdapter {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jLabel9_mouseAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void mouseClicked(MouseEvent e) {
adaptee.jLabel9_mouseClicked(e);
}
}
class BCRemoteControlApplet_jMenuItem1_itemAdapter implements java.awt.event.ItemListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jMenuItem1_itemAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void itemStateChanged(ItemEvent e) {
adaptee.jMenuItem1_itemStateChanged(e);
}
}
class BCRemoteControlApplet_jMenuItem1_mouseAdapter extends java.awt.event.MouseAdapter {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jMenuItem1_mouseAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void mouseClicked(MouseEvent e) {
adaptee.jMenuItem1_mouseClicked(e);
}
}
class BCRemoteControlApplet_jCheckBox2_itemAdapter implements java.awt.event.ItemListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jCheckBox2_itemAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void itemStateChanged(ItemEvent e) {
adaptee.jCheckBox2_itemStateChanged(e);
}
}
class BCRemoteControlApplet_jMenuItem5_actionAdapter implements java.awt.event.ActionListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jMenuItem5_actionAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jMenuItem5_actionPerformed(e);
}
}
class BCRemoteControlApplet_jButton3_actionAdapter implements java.awt.event.ActionListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jButton3_actionAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton3_actionPerformed(e);
}
}
class BCRemoteControlApplet_jButton4_actionAdapter implements java.awt.event.ActionListener {
BCRemoteControlApplet adaptee;
BCRemoteControlApplet_jButton4_actionAdapter(BCRemoteControlApplet adaptee) {
this.adaptee = adaptee;
}
public void actionPerformed(ActionEvent e) {
adaptee.jButton4_actionPerformed(e);
}
}
I realized that I took the label click functionality out of this code (that hides the panel), so you won't see that in action, but let me know if anything looks out of whack.
> I realized that I took the label click functionality
> out of this code (that hides the panel), so you won't
> see that in action, but let me know if anything looks
> out of whack.
Sorry but I don't feel like trying to understand this Wizard generated code. It is unmaintainable.
Swing related questions should be posted in the Swing forum.
If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.
And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the code retains its original formatting.