lbl.setAlignmentY(0.5f); add(lbl2); SessionDropDown sessionDropDown = new SessionDropDown(app); sessionDropDown.setAlignmentY(0.5f); add(sessionDropDown);
lbl.setAlignmentY(0.5f); add(lbl2); SessionDropDown sessionDropDown = new SessionDropDown(app); sessionDropDown.setAlignmentY(0.5f); add(sessionDropDown);
SessionDropDown(IApplication app) { super(); _app = app; final SessionManager sessionManager = _app.getSessionManager(); final SessionDropDownModel model = new SessionDropDownModel( sessionManager); setModel(model); // Under JDK1.4 the first item in a JComboBox // is no longer automatically selected. if (getModel().getSize() > 0) { setSelectedIndex(0); } else { // Under JDK1.4 an empty JComboBox has an almost zero width. Dimension dm = getPreferredSize(); dm.width = 200; setPreferredSize(dm); // Dont enable the session drop down if it is empty setEnabled(false); } addActionListener(this); setMaximumSize(getPreferredSize()); sessionManager.addSessionListener(new MySessionListener(model, this)); }
SessionDropDown(IApplication app) { super(); _app = app; final SessionManager sessionManager = _app.getSessionManager(); final SessionDropDownModel model = new SessionDropDownModel( sessionManager); setModel(model); // Under JDK1.4 the first item in a JComboBox // is no longer automatically selected. if (getModel().getSize() > 0) { setSelectedIndex(0); } else { // Under JDK1.4 an empty JComboBox has an almost zero width. Dimension dm = getPreferredSize(); dm.width = 200; setPreferredSize(dm); // Dont enable the session drop down if it is empty setEnabled(false); } addActionListener(this); setMaximumSize(getPreferredSize()); sessionManager.addSessionListener(new MySessionListener(model, this)); }
/** * An session has been selected in the list so set it as the active session. * * @param evt Describes the event that has just occured. */ public void actionPerformed(ActionEvent evt) { if (!_closing && !_dontReactToSessionDropDownAction) { final Object obj = getSelectedItem(); if (obj instanceof ISession) { _app.getSessionManager().setActiveSession((ISession)obj, false); } } } }
/** * An session has been selected in the list so set it as the active session. * * @param evt Describes the event that has just occured. */ public void actionPerformed(ActionEvent evt) { if (!_closing && !_dontReactToSessionDropDownAction) { final Object obj = getSelectedItem(); if (obj instanceof ISession) { _app.getSessionManager().setActiveSession((ISession)obj, false); } } } }
public void run() { _model.addSession(session); _sessionDropDown.setEnabled(true); } });
public void run() { _model.addSession(session); _sessionDropDown.setEnabled(true); } });
public void run() { _sessionDropDown._closing = true; _model.removeSession(session); if (_model.getSize() == 0) { _sessionDropDown.setEnabled(false); } _sessionDropDown._closing = false; } });
public void run() { _sessionDropDown._closing = true; _model.removeSession(session); if (_model.getSize() == 0) { _sessionDropDown.setEnabled(false); } _sessionDropDown._closing = false; } });