public void actionPerformed(ActionEvent e) { if (e.getSource() == top) { tabbedpane.setTabPlacement(JTabbedPane.TOP); } else if (e.getSource() == left) { tabbedpane.setTabPlacement(JTabbedPane.LEFT); } else if (e.getSource() == bottom) { tabbedpane.setTabPlacement(JTabbedPane.BOTTOM); } else if (e.getSource() == right) { tabbedpane.setTabPlacement(JTabbedPane.RIGHT); } }
private void createHolder() { // We display the views in a customised tab pane. // This means that if there are multiple views in // a particular area they get stacked and are accessible // to the user. tabbedHolder = new ViewTabbedPane(); tabbedHolder.setTabPlacement(SwingConstants.BOTTOM); // Set the minimum size of the holder so that the // split panes can be dragged around easily. We don't // want to set the size to zero, because this allows the // contents of the split pane to be completely hidden, // which could be confusing for the user. // tabbedHolder.setMinimumSize(new Dimension(10, 10)); tabbedHolder.addContainerListener( new ContainerListener() { public void componentAdded(ContainerEvent e) { if (tabbedHolder.getComponentCount() == 1) { ViewHolder.this.add(tabbedHolder); } } public void componentRemoved(ContainerEvent e) { if (tabbedHolder.getComponentCount() == 0) { ViewHolder.this.remove(tabbedHolder); } } }); }
private JTabbedPane getJTabbedPane0() { if (jTabbedPane0 == null) { jTabbedPane0 = new JTabbedPane(); jTabbedPane0.add( getJSplitPane0(), new Constraints(new Bilateral(7, 0, 39), new Bilateral(7, 0, 39))); jTabbedPane0.setTabPlacement(JTabbedPane.LEFT); jTabbedPane0.setFont(new Font("Arial", Font.PLAIN, 10)); jTabbedPane0.setTitleAt(0, "<HTML> T<BR>a<BR>s<BR>k<BR>R<BR>e<BR>p<BR>o<BR>r<BR>r<BR>t<BR>"); jTabbedPane0.addMouseListener( new MouseAdapter() { public void mouseEntered(MouseEvent event) { jTabbedPane0MouseMouseEntered(event); } public void mouseClicked(MouseEvent event) { jTabbedPane0MouseMouseClicked(event); } }); jTabbedPane0.addMouseWheelListener( new MouseWheelListener() { public void mouseWheelMoved(MouseWheelEvent event) { jTabbedPane0MouseWheelMouseWheelMoved(event); } }); } return jTabbedPane0; }
protected void addTabs(University university) { JTabbedPane mainTabsPanel = new JTabbedPane(); mainTabsPanel.setTabPlacement(JTabbedPane.LEFT); mainTabsPanel.add(new MainPanel()); mainTabsPanel.add(new ProfessorsPanel(university.getProfessorsDepartment())); mainTabsPanel.add(new ClassroomsPanel(university.getClassroomsDepartment())); mainTabsPanel.add(new RequestsPanel(university.getRequestsDepartment())); mainTabsPanel.add(new MobileResourcesPanel(university.getResourcesDepartment())); mainTabsPanel.add(new AssignmentsPanel(university.getAssignmentsDepartment())); mainTabsPanel.add(new BookingsPanel(university.getAssignmentsDepartment())); add(mainTabsPanel); }
@Override public void createPartControl(Composite parent) { ListenerStore.addListener(this); plate = new Composite(parent, SWT.EMBEDDED | SWT.NO_BACKGROUND); frame = SWT_AWT.new_Frame(plate); frame.setLayout(new java.awt.GridLayout(1, 1)); // panel = new JPanel(); tabbedPane = new JTabbedPane(); tabbedPane.setTabPlacement(JTabbedPane.LEFT); frame.add(tabbedPane); }
// Handle the menu item action events public void actionPerformed(ActionEvent ae) { String s = ae.getActionCommand(); if (s.equals("Exit")) { System.exit(0); } if (s.equals("About")) { joptionpane.showMessageDialog(frame, "Rolodex version 0.1\n(c) 2014 Jong Woo Lee"); } if (s.equals("Left")) { jtp.setTabPlacement(JTabbedPane.LEFT); } if (s.equals("Top")) { jtp.setTabPlacement(JTabbedPane.TOP); } if (s.equals("Bottom")) { jtp.setTabPlacement(JTabbedPane.BOTTOM); } if (s.equals("Right")) { jtp.setTabPlacement(JTabbedPane.RIGHT); } if (s.equals("Defaults")) { jtp.setTabPlacement(JTabbedPane.TOP); } if (s.equals("Scroll")) { jtp.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); } if (s.equals("Wrap")) { jtp.setTabLayoutPolicy(JTabbedPane.WRAP_TAB_LAYOUT); } }
private void buildDialog() { dialog = new SwingConfigurationDialogImpl( "SoapUI Preferences", HelpUrls.PREFERENCES_HELP_URL, "Set global SoapUI settings", UISupport.OPTIONS_ICON); tabs = new JTabbedPane(); tabs.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); tabs.setTabPlacement(JTabbedPane.LEFT); for (Prefs pref : prefs) { tabs.addTab(pref.getTitle(), new JScrollPane(pref.getForm().getPanel())); } dialog.setContent(UISupport.createTabPanel(tabs, false)); }
private void propertiesHaveChanged(String propName) { final SessionProperties props = _session.getProperties(); if (propName == null || propName.equals(SessionProperties.IPropertyNames.AUTO_COMMIT)) { SetAutoCommitTask task = new SetAutoCommitTask(); if (SwingUtilities.isEventDispatchThread()) { _session.getApplication().getThreadPool().addTask(task); } else { task.run(); } } if (propName == null || propName.equals(SessionProperties.IPropertyNames.SQL_EXECUTION_TAB_PLACEMENT)) { _tabbedExecutionsPanel.setTabPlacement(props.getSQLExecutionTabPlacement()); } }
public static void init( JTabbedPane comp, Thing thing, Container parent, ActionContext actionContext) { JComponentCreator.init(comp, thing, parent, actionContext); Integer tabLayoutPolicy = null; String v = thing.getString("tabLayoutPolicy"); if ("WRAP_TAB_LAYOUT".equals(v)) { tabLayoutPolicy = JTabbedPane.WRAP_TAB_LAYOUT; } else if ("WRAP_TAB_LAYOUT".equals(v)) { tabLayoutPolicy = JTabbedPane.WRAP_TAB_LAYOUT; } if (tabLayoutPolicy != null) { comp.setTabLayoutPolicy(tabLayoutPolicy); } Integer tabPlacement = JavaCreator.createInteger(thing, "tabPlacement"); if (tabPlacement != null) { comp.setTabPlacement(tabPlacement); } }
public MyWindow3() { tp = new JTabbedPane(); JPanel p1 = new JPanel(); p1.setBackground(Color.red); JPanel p2 = new JPanel(); p2.setBackground(Color.blue); JPanel p3 = new JPanel(); p3.setBackground(Color.MAGENTA); tp.setTabPlacement(tp.BOTTOM); tp.addTab("red", p1); tp.addTab("blue", p2); tp.addTab("Magenta", p3); add("Center", tp); setSize(640, 480); setVisible(true); }
// private JPanel jpan public GuiMainApp(Properties properties) { pres = new PresentorApp(this); pres.initLudotheque(properties); btn.setVisible(true); btn.addActionListener(pres); this.setLayout(new BorderLayout()); p.setLayout(new BorderLayout()); p.setVisible(false); p.add(btn, BorderLayout.EAST); btnModif.setVisible(true); btnModif.addActionListener(pres); p.add(btnModif, BorderLayout.WEST); add(p, BorderLayout.NORTH); tabbedpane.setTabPlacement(JTabbedPane.TOP); tabbedpane.setForeground(Color.BLUE); add(tabbedpane, BorderLayout.CENTER); }
private void onPropertyChange(String propertyName) { if (propertyName.equals(SessionProperties.IPropertyNames.SQL_EXECUTION_TAB_PLACEMENT)) { _tabbedExecutionsPanel.setTabPlacement( _session.getProperties().getSQLExecutionTabPlacement()); } }
public void initComponents() { function = new Detail( "function", extractor, cz.cvut.felk.cig.jcool.ui.view.ExperimentDetails.Detail.Type.TABLE); experiment.addPropertyChangeListener(function); methodComponents = new DelegatedDetail( "methodComponents", extractor, cz.cvut.felk.cig.jcool.ui.view.ExperimentDetails.Detail.Type.LIST, this.model); model.addPropertyChangeListener(methodComponents); method = new DelegatedDetail( "method", extractor, cz.cvut.felk.cig.jcool.ui.view.ExperimentDetails.Detail.Type.TABLE, this.model); model.addPropertyChangeListener(method); solver = new Detail( "solver", extractor, cz.cvut.felk.cig.jcool.ui.view.ExperimentDetails.Detail.Type.TABLE); experiment.addPropertyChangeListener(solver); conditions = new Detail( "stopconditions", extractor, cz.cvut.felk.cig.jcool.ui.view.ExperimentDetails.Detail.Type.LIST); experiment.addPropertyChangeListener(conditions); visualizations = new Detail( "visualizations", extractor, cz.cvut.felk.cig.jcool.ui.view.ExperimentDetails.Detail.Type.LIST); experiment.addPropertyChangeListener(visualizations); JTabbedPane pane = new JTabbedPane(); pane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); if (SystemUtils.IS_OS_MAC) { pane.setTabPlacement(JTabbedPane.RIGHT); } pane.addTab("Function", function); pane.addTab("Method", method); pane.addTab("MethodComponents", methodComponents); pane.addTab("Solver", solver); pane.addTab("Conditions", conditions); pane.addTab("Visualizations", visualizations); setLayout(new BorderLayout()); add(pane, BorderLayout.CENTER); }
/** * Method for adding components to the content pane. * * @param pane the pane to where the components are added */ private void addComponentsToPane(Container pane) { pane.setLayout(new BorderLayout()); // Panels JPanel northPanel = new JPanel(); JPanel northRightPanel = new JPanel(); JPanel northLeftPanel = new JPanel(); JPanel southPanel = new JPanel(); // list this.doneList = new JList(doneListModel); this.doneList.addMouseListener(new TodoMouseListener(controller)); this.doneList.setCellRenderer(new ToDoListRenderer()); this.deletedList = new JList(deletedListModel); this.deletedList.addMouseListener(new TodoMouseListener(controller)); this.deletedList.setCellRenderer(new ToDoListRenderer()); this.overdueList = new JList(overdueListModel); this.overdueList.addMouseListener(new TodoMouseListener(controller)); this.overdueList.setCellRenderer(new ToDoListRenderer()); // table this.table = createTable(); this.table.addMouseListener(new TodoMouseListener(controller)); this.table.getColumnModel().getColumn(3).setCellRenderer(new ToDoTableRenderer()); // Scroll pane JScrollPane scrollPane = new JScrollPane(table); JScrollPane donePane = new JScrollPane(doneList); JScrollPane deletePane = new JScrollPane(deletedList); JScrollPane overDuePane = new JScrollPane(overdueList); // Text fields and buttons JTextField inputFld = new JTextField(); JButton addBtn = new JButton(controller.getAddAction()); this.testPane = new JTabbedPane(); this.testPane.addTab(lang.getText("ui.mainview.radiobutton.viewpending"), null, scrollPane); this.testPane.addTab(lang.getText("ui.mainview.radiobutton.viewdone"), null, donePane); this.testPane.addTab(lang.getText("ui.mainview.radiobutton.viewoverdue"), null, overDuePane); this.testPane.addTab(lang.getText("ui.mainview.radiobutton.viewdeleted"), null, deletePane); this.testPane.setMnemonicAt(0, KeyEvent.VK_1); this.testPane.setMnemonicAt(1, KeyEvent.VK_2); this.testPane.setMnemonicAt(2, KeyEvent.VK_3); this.testPane.setMnemonicAt(3, KeyEvent.VK_4); // Add to pane pane.add(testPane, BorderLayout.CENTER); pane.add(northPanel, BorderLayout.NORTH); pane.add(southPanel, BorderLayout.SOUTH); testPane.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); testPane.setTabPlacement(JTabbedPane.TOP); // Set layouts and alignment southPanel.setLayout(new BorderLayout()); northPanel.setLayout(new BorderLayout()); inputFld.setHorizontalAlignment(JTextField.LEFT); // Set up south panel southPanel.add(inputFld, BorderLayout.CENTER); southPanel.add(addBtn, BorderLayout.EAST); // Set up north panel northPanel.add(northLeftPanel, BorderLayout.CENTER); northPanel.add(northRightPanel, BorderLayout.EAST); // Adding clock to north panels northRightPanel.add(timeLabel); // creates the clock final DateFormat timeFormat = new SimpleDateFormat("HH:mm"); final DateFormat timeFormat2 = new SimpleDateFormat("HH mm"); ActionListener timerListener = new ActionListener() { public void actionPerformed(ActionEvent e) { Date date = new Date(); String time; if ((date.getTime() / 1000 % 2) == 0) { time = timeFormat.format(date); // even seconds } else { time = timeFormat2.format(date); // odd seconds } timeLabel.setText(time); timeLabel.setFont(new Font("Arial", Font.PLAIN, 15)); timeLabel.setToolTipText(new SimpleDateFormat("EEE., yyyy-MM-dd HH:mm").format(date)); } }; Timer timer = new Timer(1000, timerListener); // to make sure it doesn't wait one second at the start timer.setInitialDelay(0); timer.start(); scrollPane.setColumnHeaderView(createTable().getTableHeader()); ((AddAction) addBtn.getAction()).setTextField(inputFld); inputFld.addKeyListener( new KeyAdapter() { public void keyReleased(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { JTextField textField = (JTextField) e.getSource(); String text = textField.getText(); controller.addItem(text); textField.setText(""); } // String text = textField.getText(); // textField.setText(text.toUpperCase()); } }); }
private void jbInit() throws Exception { //////////////////////////////////////////////////////// // Init LAF //////////////////////////////////////////////////////// ButtonGroup grpLAF = new ButtonGroup(); ActionListener lsnLAF = new ActionListener() { public void actionPerformed(ActionEvent evt) { int iIndex = mvtLAFItem.indexOf(evt.getSource()); if (iIndex >= 0) changeLAF(iIndex); } }; //////////////////////////////////////////////////////// UIManager.LookAndFeelInfo laf = new UIManager.LookAndFeelInfo( "Kunststoff", "com.incors.plaf.kunststoff.KunststoffLookAndFeel"); marrLaf = UIManager.getInstalledLookAndFeels(); int iIndex = 0; while (iIndex < marrLaf.length && !marrLaf[iIndex].getName().equals(laf.getName())) iIndex++; if (iIndex >= marrLaf.length) { UIManager.installLookAndFeel(laf); marrLaf = UIManager.getInstalledLookAndFeels(); } for (iIndex = 0; iIndex < marrLaf.length; iIndex++) { JMenuItem mnu = new JRadioButtonMenuItem(marrLaf[iIndex].getName()); mnu.addActionListener(lsnLAF); mvtLAFItem.addElement(mnu); mnuUI.add(mnu); grpLAF.add(mnu); } mnuUI.addSeparator(); //////////////////////////////////////////////////////// // Init language //////////////////////////////////////////////////////// ButtonGroup grpLanguage = new ButtonGroup(); ActionListener lsnLanguage = new ActionListener() { public void actionPerformed(ActionEvent e) { int iIndex = mvtLanguageItem.indexOf(e.getSource()); if (iIndex >= 0) changeDictionary((String) mvtLanguage.elementAt(iIndex)); } }; //////////////////////////////////////////////////////// String[] str = MonitorDictionary.getSupportedLanguage(); for (iIndex = 0; iIndex < str.length; iIndex++) { JMenuItem mnu = new JRadioButtonMenuItem(MonitorDictionary.getDictionary(str[iIndex]).getLanguage()); mnu.addActionListener(lsnLanguage); mvtLanguage.addElement(str[iIndex]); mvtLanguageItem.addElement(mnu); mnuUI.add(mnu); grpLanguage.add(mnu); } //////////////////////////////////////////////////////// // Add to main menu //////////////////////////////////////////////////////// mnuMain.removeAll(); mnuMain.add(mnuSystem); mnuSystem.add(mnuSystem_Login); mnuSystem.add(mnuSystem_ChangePassword); mnuSystem.addSeparator(); mnuSystem.add(mnuSystem_StopServer); mnuSystem.add(mnuSystem_EnableThreads); mnuMain.add(mnuUI); mnuMain.add(mnuHelp); mnuHelp.add(mnuHelp_About); //////////////////////////////////////////////////////// mnuMain.add(chkVietnamese); mnuMain.add(lblStatus); //////////////////////////////////////////////////////// pnlThread.setTabPlacement(JTabbedPane.LEFT); pnlThread.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); //////////////////////////////////////////////////////// tblUser.addColumn("", 1, false); tblUser.addColumn("", 2, false, Global.FORMAT_DATE_TIME); tblUser.addColumn("", 3, false); //////////////////////////////////////////////////////// JPanel pnlMessage = new JPanel(); pnlMessage.setLayout(new GridBagLayout()); pnlMessage.add( new JScrollPane(txtBoard), new GridBagConstraints( 0, 0, 2, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); pnlMessage.add( txtMessage, new GridBagConstraints( 0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); pnlMessage.add( btnSend, new GridBagConstraints( 1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(2, 2, 2, 2), 0, 0)); txtBoard.setEditable(false); txtBoard.setAutoscrolls(true); txtBoard.setContentType("text/html"); clearAll(txtBoard); //////////////////////////////////////////////////////// JPanel pnlUserButton = new JPanel(new GridLayout(1, 2, 4, 4)); pnlUserButton.add(btnKick); pnlUserButton.add(btnRefresh); //////////////////////////////////////////////////////// JPanel pnlManager = new JPanel(new GridBagLayout()); pnlManager.add( new JScrollPane(tblUser), new GridBagConstraints( 0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(2, 2, 2, 2), 0, 0)); pnlManager.add( pnlUserButton, new GridBagConstraints( 0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(4, 2, 4, 2), 0, 0)); //////////////////////////////////////////////////////// pnlUser.setDividerLocation(320); pnlUser.setLeftComponent(pnlManager); pnlUser.setRightComponent(pnlMessage); pnlUser.setOneTouchExpandable(true); //////////////////////////////////////////////////////// setOrientation(JSplitPane.VERTICAL_SPLIT); setOneTouchExpandable(true); pnlThread.setVisible(false); pnlUser.setVisible(false); setTopComponent(pnlThread); setBottomComponent(pnlUser); //////////////////////////////////////////////////////// pmn.add(mnuSelectAll); pmn.addSeparator(); pmn.add(mnuClearSelected); pmn.add(mnuClearAll); //////////////////////////////////////////////////////// setBorder(BorderFactory.createEmptyBorder()); pnlUser.setBorder(BorderFactory.createEmptyBorder()); pnlManager.setBorder( BorderFactory.createBevelBorder( javax.swing.border.BevelBorder.RAISED, Color.white, UIManager.getColor("Panel.background"), UIManager.getColor("Panel.background"), UIManager.getColor("Panel.background"))); pnlMessage.setBorder( BorderFactory.createBevelBorder( javax.swing.border.BevelBorder.RAISED, Color.white, UIManager.getColor("Panel.background"), UIManager.getColor("Panel.background"), UIManager.getColor("Panel.background"))); //////////////////////////////////////////////////////// Skin.applySkin(mnuMain); Skin.applySkin(tblUser); Skin.applySkin(pmn); Skin.applySkin(this); //////////////////////////////////////////////////////// // Default setting //////////////////////////////////////////////////////// Hashtable prt = null; try { prt = Global.loadHashtable(Global.FILE_CONFIG); } catch (Exception e) { prt = new Hashtable(); } changeLAF(Integer.parseInt(StringUtil.nvl(prt.get("LAF"), "0"))); changeDictionary(StringUtil.nvl(prt.get("Language"), "VN")); Skin.LANGUAGE_CHANGE_LISTENER = this; MonitorProcessor.setRootObject(this); updateKeyboardUI(); //////////////////////////////////////////////////////// // Event handler //////////////////////////////////////////////////////// tblUser.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1) btnKick.doClick(); } }); //////////////////////////////////////////////////////// btnRefresh.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent evt) { try { DDTP request = new DDTP(); request.setRequestID(String.valueOf(System.currentTimeMillis())); DDTP response = channel.sendRequest("ThreadProcessor", "queryUserList", request); if (response != null) { tblUser.setData((Vector) response.getReturn()); if (mstrChannel != null) removeUser(mstrChannel); } } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } } }); //////////////////////////////////////////////////////// btnKick.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent evt) { int iSelected = tblUser.getSelectedRow(); if (iSelected < 0) return; int iResult = MessageBox.showConfirmDialog( pnlThread, mdic.getString("ConfirmKick"), Global.APP_NAME, MessageBox.YES_NO_OPTION); if (iResult == MessageBox.NO_OPTION) return; try { String strChannel = (String) tblUser.getRow(iSelected).elementAt(0); DDTP request = new DDTP(); request.setRequestID(String.valueOf(System.currentTimeMillis())); request.setString("strChannel", strChannel); DDTP response = channel.sendRequest("ThreadProcessor", "kickUser", request); } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } } }); //////////////////////////////////////////////////////// txtMessage.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent evt) { btnSend.doClick(); } }); //////////////////////////////////////////////////////// btnSend.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent evt) { if (txtMessage.getText().length() == 0) return; try { DDTP request = new DDTP(); request.setString("strMessage", txtMessage.getText()); channel.sendRequest("ThreadProcessor", "sendMessage", request); txtMessage.setText(""); } catch (Exception e) { e.printStackTrace(); MessageBox.showMessageDialog(pnlThread, e, Global.APP_NAME, MessageBox.ERROR_MESSAGE); } } }); //////////////////////////////////////////////////////// mnuClearAll.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { clearAll(txtBoard); } }); //////////////////////////////////////////////////////// mnuClearSelected.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { txtBoard.setEditable(true); txtBoard.replaceSelection(""); txtBoard.setEditable(false); } }); //////////////////////////////////////////////////////// mnuSelectAll.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { txtBoard.requestFocus(); txtBoard.selectAll(); } }); //////////////////////////////////////////////////////// txtBoard.addMouseListener( new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getButton() == e.BUTTON3) pmn.show(txtBoard, e.getX(), e.getY()); } }); //////////////////////////////////////////////////////// mnuSystem_Login.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { login(); } }); //////////////////////////////////////////////////////// mnuSystem_ChangePassword.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { changePassword(); } }); //////////////////////////////////////////////////////// mnuSystem_StopServer.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { stopServer(); } }); //////////////////////////////////////////////////////// mnuSystem_EnableThreads.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { manageThreads(); } }); //////////////////////////////////////////////////////// mnuHelp_About.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { WindowManager.centeredWindow(new DialogAbout(PanelThreadManager.this)); } }); //////////////////////////////////////////////////////// chkVietnamese.addActionListener( new java.awt.event.ActionListener() { public void actionPerformed(ActionEvent e) { switchKeyboard(); } }); }
public static void main(String[] xx) { // 0. Bikin Frame JFrame fr = new JFrame("Demo Tab"); // 1. Set size fr.setSize(400, 400); // 2. Tambahkan panel JTabbedPane isi = new JTabbedPane(); isi.setTabPlacement(JTabbedPane.BOTTOM); fr.getContentPane().add(isi); // 3. Tambahkan komponen JRadioButton rbPria = new JRadioButton("Pria"); JRadioButton rbWanita = new JRadioButton("Wanita"); // dalam satu group harus pilih salah satu ButtonGroup bgJenis = new ButtonGroup(); bgJenis.add(rbPria); bgJenis.add(rbWanita); JPanel pnlJenis = new JPanel(); pnlJenis.add(new JLabel("Jenis Kelamin : ")); pnlJenis.add(rbPria); pnlJenis.add(rbWanita); isi.addTab("Jenis Kelamin", pnlJenis); JCheckBox cbMembaca = new JCheckBox("Membaca"); JCheckBox cbBerenang = new JCheckBox("Berenang"); JPanel pnlHobi = new JPanel(); pnlHobi.add(new JLabel("Hobi")); pnlHobi.add(cbMembaca); pnlHobi.add(cbBerenang); isi.addTab("Hobi", pnlHobi); JButton btnSimpan = new JButton("Simpan"); JButton btnBatal = new JButton("Batal"); btnBatal.setEnabled(false); // enable/disable JPanel pnlTombol = new JPanel(); pnlTombol.add(btnSimpan); pnlTombol.add(btnBatal); isi.addTab("Proses", pnlTombol); JSlider slider = new JSlider( JSlider.HORIZONTAL, 0, // minimum 100, // maksimum 10 // posisi awal ); JPanel pnlSlider = new JPanel(); pnlSlider.add(new JLabel("Volume : ")); pnlSlider.add(slider); isi.addTab("Slider", pnlSlider); int tahun = 2012; SpinnerModel spTahun = new SpinnerNumberModel( tahun, // posisi awal tahun - 100, // minimum tahun + 100, // maksimum 1 // increment/decrement ); JSpinner spinner = new JSpinner(spTahun); spinner.setEditor(new JSpinner.NumberEditor(spinner, "####")); JPanel pnlSpin = new JPanel(); pnlSpin.add(new JLabel("Tahun : ")); pnlSpin.add(spinner); isi.addTab("Spinner", pnlSpin); // 4. Tampilkan fr.setLocationRelativeTo(null); fr.setVisible(true); }
public LifeWaysVersion4() { // This will create the title you see in the upper left of the window setTitle("LIFE+WAYS V4"); // set size of window setSize(600, 400); // ensures program will stop running when window closed setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // Here we are creating the object JTabbedPane tabs = new JTabbedPane(); // Sets tabs at the bottom of the page tabs.setTabPlacement(JTabbedPane.BOTTOM); // This creates the template on the windowed application that we will be using getContentPane().add(tabs); JPanel profile = new JPanel(); // This will create the first tab JPanel calendar = new JPanel(); // This will create the second tab new JPanel vitals = new JPanel(); // This will create the third tab JPanel medications = new JPanel(); // This will create the fourth tab JPanel nutrition = new JPanel(); // This will create the fifth tab JPanel report = new JPanel(); // This will create the sixth tab // This adds the first and second tab to our tabbed pane object and names it tabs.addTab("Profile", profile); tabs.addTab("Calendar", calendar); tabs.addTab("Vitals", vitals); tabs.addTab("Medications", medications); tabs.addTab("Nutrition", nutrition); tabs.addTab("Report", report); // 1: Profile Tab // Profile Tab Panel profile.setLayout(new BorderLayout()); profile.add(new ProfileTab(), BorderLayout.CENTER); // 2: Calendar Tab (Jamee) // Temporary Text JLabel tempLabel2 = new JLabel(); tempLabel2.setText("Calendar Tab... Under Construction"); calendar.add(tempLabel2); // 3: Vitals Tab // Vitals Tab Panel vitals.setLayout(new BorderLayout()); vitals.add(new VitalsTab(), BorderLayout.CENTER); // 4: Medications Tab // Medications Tab Panel medications.setLayout(new BorderLayout()); medications.add(new MedicationsTab(), BorderLayout.CENTER); // 5: Nutrition Tab // Nutrition Tab Panel nutrition.setLayout(new BorderLayout()); nutrition.add(new NutritionTab(), BorderLayout.CENTER); // 6: Report Tab (Supathorn) // Report Tab Panel // Medications Tab Panel report.setLayout(new BorderLayout()); report.add(new ReportTab(), BorderLayout.CENTER); // activates GUI setVisible(true); }