List of usage examples for javax.swing SwingConstants LEFT
int LEFT
To view the source code for javax.swing SwingConstants LEFT.
Click Source Link
From source file:com.openbravo.pos.sales.restaurant.JRetailTicketsBagRestaurantMap.java
private JPanel getLabelPanel(String msg) { JPanel panel = new JPanel(); Font font = new Font("Verdana", Font.BOLD, 12); panel.setFont(font);/* ww w.ja va 2 s .c o m*/ panel.setOpaque(true); JLabel label = new JLabel(msg, JLabel.LEFT); label.setForeground(Color.RED); label.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); panel.add(label); return panel; }
From source file:SortableTable.java
/** * Creates a new button renderer.//from ww w . j av a2s. c o m */ public SortButtonRenderer() { this.pressedColumn = -1; this.useLabels = UIManager.getLookAndFeel().getID().equals("Aqua"); final Border border = UIManager.getBorder("TableHeader.cellBorder"); if (this.useLabels) { this.normalLabel = new JLabel(); this.normalLabel.setHorizontalAlignment(SwingConstants.LEADING); this.ascendingLabel = new JLabel(); this.ascendingLabel.setHorizontalAlignment(SwingConstants.LEADING); this.ascendingLabel.setHorizontalTextPosition(SwingConstants.LEFT); this.ascendingLabel.setIcon(new BevelArrowIcon(BevelArrowIcon.DOWN, false, false)); this.descendingLabel = new JLabel(); this.descendingLabel.setHorizontalAlignment(SwingConstants.LEADING); this.descendingLabel.setHorizontalTextPosition(SwingConstants.LEFT); this.descendingLabel.setIcon(new BevelArrowIcon(BevelArrowIcon.UP, false, false)); this.normalLabel.setBorder(border); this.ascendingLabel.setBorder(border); this.descendingLabel.setBorder(border); } else { this.normalButton = new JButton(); this.normalButton.setMargin(new Insets(0, 0, 0, 0)); this.normalButton.setHorizontalAlignment(SwingConstants.LEADING); this.ascendingButton = new JButton(); this.ascendingButton.setMargin(new Insets(0, 0, 0, 0)); this.ascendingButton.setHorizontalAlignment(SwingConstants.LEADING); this.ascendingButton.setHorizontalTextPosition(SwingConstants.LEFT); this.ascendingButton.setIcon(new BevelArrowIcon(BevelArrowIcon.DOWN, false, false)); this.ascendingButton.setPressedIcon(new BevelArrowIcon(BevelArrowIcon.DOWN, false, true)); this.descendingButton = new JButton(); this.descendingButton.setMargin(new Insets(0, 0, 0, 0)); this.descendingButton.setHorizontalAlignment(SwingConstants.LEADING); this.descendingButton.setHorizontalTextPosition(SwingConstants.LEFT); this.descendingButton.setIcon(new BevelArrowIcon(BevelArrowIcon.UP, false, false)); this.descendingButton.setPressedIcon(new BevelArrowIcon(BevelArrowIcon.UP, false, true)); this.normalButton.setBorder(border); this.ascendingButton.setBorder(border); this.descendingButton.setBorder(border); } }
From source file:com.titan.mainframe.MainFrame.java
public MainFrame() { String osName = System.getProperty("os.name").toLowerCase(); if (osName.toLowerCase().contains("mac")) { com.apple.eawt.Application macApp = com.apple.eawt.Application.getApplication(); macApp.addApplicationListener(this); }/*from w w w .j av a 2 s.com*/ addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { handleQuit(); } @Override public void windowOpened(WindowEvent e) { windowOpened = true; } }); setTitle("Titan " + Global.version); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); if (TitanSetting.getInstance().width == 0 || TitanSetting.getInstance().height == 0) { setBounds(TitanSetting.getInstance().x, TitanSetting.getInstance().y, 1200, 700); } else { setBounds(TitanSetting.getInstance().x, TitanSetting.getInstance().y, TitanSetting.getInstance().width, TitanSetting.getInstance().height); } setIconImage(new ImageIcon(getClass().getClassLoader().getResource("com/titan/image/titan_icon.png")) .getImage()); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(new BorderLayout(0, 0)); splitPane.setDividerLocation(TitanSetting.getInstance().mainframeDivX); contentPane.add(splitPane, BorderLayout.CENTER); JPanel panel = new JPanel(); panel.setLayout(new BorderLayout(0, 0)); JLabel logoLabel = new JLabel(); logoLabel.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent e) { mainContentPanel.removeAll(); mainContentPanel.add(welcomePanel, BorderLayout.CENTER); mainContentPanel.updateUI(); } }); // try { // BufferedImage b = ImageIO.read(MainFrame.class.getResource("/com/titan/image/titanLogo.png")); // Image i = b.getScaledInstance((int) (b.getWidth() * 0.6), (int) (b.getHeight() * 0.6), Image.SCALE_SMOOTH); logoLabel.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/titanLogo.png"))); // } catch (IOException e1) { // e1.printStackTrace(); // } // logoLabel.setMaximumSize(new Dimension(150, 150)); JPanel controlPanel = new JPanel(); controlPanel.setBackground(new Color(239, 249, 255)); controlPanel.setOpaque(true); panel.add(controlPanel, BorderLayout.CENTER); controlPanel.setLayout(new BorderLayout()); JScrollPane computeScrollPane = new JScrollPane(); tabbedPane.addTab("Compute", computeScrollPane); controlPanel.add(tabbedPane, BorderLayout.CENTER); serverTree = new JTree(); serverTree.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { // Object obj = mainContentPanel.getComponent(0); // if (obj instanceof VMMainPanel) { // ((MainPanel) obj).refresh(); // } } }); serverTree.setModel(computeTreeModel); serverTree.setCellRenderer(new ZoneTreeRenderer()); serverTree.setRootVisible(false); computeScrollPane.setViewportView(serverTree); updateComputeTree(); JScrollPane zoneScrollPane = new JScrollPane(); tabbedPane.addTab("Zone", zoneScrollPane); zoneTree = new JTree(); zoneTree.setModel(zoneTreeModel); zoneTree.setCellRenderer(new ZoneTreeRenderer()); zoneScrollPane.setViewportView(zoneTree); updateZoneTree(); splitPane.setLeftComponent(panel); splitPane.setRightComponent(mainContentPanel); mainContentPanel.setLayout(new BorderLayout(0, 0)); welcomePanel = new WelcomePanel(); mainContentPanel.add(welcomePanel, BorderLayout.CENTER); welcomePanel.setLayout(new BorderLayout(0, 0)); welcomePanel.add(mainScreenLabel, BorderLayout.CENTER); mainScreenLabel.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/mainscreen.png"))); JPanel panel_1 = new JPanel(); welcomePanel.add(panel_1, BorderLayout.SOUTH); JButton licenseButton = new JButton("License"); licenseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { InputStream in = MainFrame.class.getResourceAsStream("/com/titan/license.txt"); try { LicenseDialog dialog = new LicenseDialog(MainFrame.this, IOUtils.toString(in)); CommonLib.centerDialog(dialog); dialog.setVisible(true); } catch (IOException e1) { e1.printStackTrace(); } finally { IOUtils.closeQuietly(in); } } }); panel_1.add(licenseButton); ribbonPanel = new JPanel(); contentPane.add(ribbonPanel, BorderLayout.NORTH); ribbonPanel.setLayout(new BorderLayout(0, 0)); ribbonTabbedPane = new JTabbedPane(JTabbedPane.TOP); ribbonTabbedPane.addChangeListener(new ChangeListener() { public void stateChanged(ChangeEvent e) { // if (!windowOpened) { // return; // } String tab = ribbonTabbedPane.getTitleAt(ribbonTabbedPane.getSelectedIndex()); if (tab.equals("Server")) { if (mainServerPanel == null || !mainServerPanel.serverPanel.jprogressBarDialog.isActive()) { SwingUtilities.invokeLater(new Runnable() { public void run() { mainContentPanel.removeAll(); mainServerPanel = new MainServerPanel(MainFrame.this); mainContentPanel.add(mainServerPanel, BorderLayout.CENTER); mainContentPanel.updateUI(); } }); } } else if (tab.equals("VM")) { SwingUtilities.invokeLater(new Runnable() { public void run() { mainContentPanel.removeAll(); mainContentPanel.add(new VMMainPanel(MainFrame.this), BorderLayout.CENTER); mainContentPanel.updateUI(); } }); } else if (tab.equals("Keystone")) { mainContentPanel.removeAll(); mainContentPanel.add(new KeystonePanel(MainFrame.this), BorderLayout.CENTER); mainContentPanel.updateUI(); } else if (tab.equals("Flavor")) { mainContentPanel.removeAll(); mainContentPanel.add(new FlavorPanel(MainFrame.this), BorderLayout.CENTER); mainContentPanel.updateUI(); } else if (tab.equals("Storage")) { mainContentPanel.removeAll(); mainContentPanel.add(new StoragePanel(MainFrame.this), BorderLayout.CENTER); mainContentPanel.updateUI(); } else if (tab.equals("Network")) { mainContentPanel.removeAll(); mainContentPanel.add(new SDNPanel(MainFrame.this), BorderLayout.CENTER); mainContentPanel.updateUI(); } else if (tab.equals("Setting")) { mainContentPanel.removeAll(); mainContentPanel.add(new SettingPanel(MainFrame.this), BorderLayout.CENTER); mainContentPanel.updateUI(); } } }); ribbonTabbedPane.putClientProperty("type", "ribbonType"); ribbonTabbedPane.setPreferredSize(new Dimension(1000, 140)); ribbonPanel.add(ribbonTabbedPane, BorderLayout.CENTER); serverPanel = new JRibbonPanel(); serverPanel.setLayout(new MigLayout("", "[][][][][][][][][][][][][][grow][]", "[grow][grow][]")); ribbonTabbedPane.addTab("Server", null, serverPanel, null); logoutButton = new JRibbonBigButton("Logout"); logoutButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { logout(); } }); rbnbgbtnAddServer = new JRibbonBigButton(); rbnbgbtnAddServer.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png"))); rbnbgbtnAddServer.setText("Add Server"); serverPanel.add(rbnbgbtnAddServer, "cell 0 0 1 3,growy"); rbnbgbtnDeleteServer = new JRibbonBigButton(); rbnbgbtnDeleteServer .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png"))); rbnbgbtnDeleteServer.setText("Delete Server"); serverPanel.add(rbnbgbtnDeleteServer, "cell 1 0 1 3,growy"); logoutButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/logout.png"))); logoutButton.setVerticalTextPosition(SwingConstants.BOTTOM); logoutButton.setHorizontalTextPosition(SwingConstants.CENTER); serverPanel.add(logoutButton, "cell 14 0 1 3,growy"); vmPanel = new JRibbonPanel(); ribbonTabbedPane.addTab("VM", null, vmPanel, null); vmPanel.setLayout(new MigLayout("", "[][][][][][][][][][][][][][][grow][]", "[grow][grow][]")); launchButton = new JRibbonBigButton("Launch"); launchButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { new LaunchInstanceDialog(MainFrame.this).setVisible(true); } }); launchButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/launch.png"))); launchButton.setVerticalTextPosition(SwingConstants.BOTTOM); launchButton.setHorizontalTextPosition(SwingConstants.CENTER); vmPanel.add(launchButton, "cell 0 0 1 3,growy"); pauseButton = new JRibbonButton("Pause"); pauseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova pause"); } }); pauseButton.setHorizontalAlignment(SwingConstants.LEFT); pauseButton.setIcon( new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/control_pause.png"))); vmPanel.add(pauseButton, "cell 2 0,growx"); stopButton = new JRibbonButton("Stop"); stopButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova stop"); } }); stopButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/stop.png"))); stopButton.setVerticalTextPosition(SwingConstants.BOTTOM); stopButton.setHorizontalTextPosition(SwingConstants.CENTER); vmPanel.add(stopButton, "cell 1 0 1 3,growy"); unpauseButton = new JRibbonButton("Unpause"); unpauseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova unpause"); } }); unpauseButton.setHorizontalAlignment(SwingConstants.LEFT); unpauseButton .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/control_play.png"))); suspendButton = new JRibbonButton("Suspend"); suspendButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova suspend"); } }); suspendButton.setHorizontalAlignment(SwingConstants.LEFT); suspendButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/disk.png"))); vmPanel.add(suspendButton, "cell 3 0,growx"); softRebootButton = new JRibbonButton("Soft reboot"); softRebootButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova soft-reboot"); } }); softRebootButton.setHorizontalAlignment(SwingConstants.LEFT); softRebootButton.setIcon(new ImageIcon( MainFrame.class.getResource("/com/titan/image/famfamfam/arrow_rotate_clockwise.png"))); selectAllVMButton = new JRibbonButton("Select all"); selectAllVMButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.selectAll(); } }); vmPanel.add(selectAllVMButton, "cell 4 0,growx"); vmPanel.add(softRebootButton, "cell 9 0,growx"); createMacroButton = new JRibbonButton("Create macro"); createMacroButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png"))); createMacroButton.setHorizontalAlignment(SwingConstants.LEFT); setGroupNameButton = new JRibbonButton("Set group name"); setGroupNameButton.setHorizontalAlignment(SwingConstants.LEFT); setGroupNameButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.setGroupName(); } }); vmPanel.add(setGroupNameButton, "cell 10 0"); vmPanel.add(createMacroButton, "cell 13 0,growx"); ribbonSeparator_3 = new JRibbonSeparator(); vmPanel.add(ribbonSeparator_3, "cell 14 0 1 3,growy"); vmPanel.add(unpauseButton, "cell 2 1,growx"); remoteButton = new JRibbonButton("Remote"); remoteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.remote(); } }); remoteButton.setHorizontalAlignment(SwingConstants.LEFT); remoteButton.setIcon(new ImageIcon( MainFrame.class.getResource("/com/titan/image/famfamfam/application_osx_terminal.png"))); unselectAllButton = new JRibbonButton("Unselect all"); unselectAllButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.unselectAll(); } }); vmPanel.add(unselectAllButton, "cell 4 1,growx"); vmPanel.add(remoteButton, "cell 2 2,growx"); performanceMeterButton = new JRibbonButton("Performance meter"); performanceMeterButton .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/chart_curve.png"))); performanceMeterButton.setHorizontalAlignment(SwingConstants.LEFT); vmPanel.add(performanceMeterButton, "cell 13 1,growx"); resumeButton = new JRibbonButton("Resume"); resumeButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova resume"); } }); resumeButton.setHorizontalAlignment(SwingConstants.LEFT); resumeButton .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/drive_disk.png"))); vmPanel.add(resumeButton, "cell 3 1,growx"); deleteButton = new JRibbonBigButton("Delete"); deleteButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova delete"); } }); vmPanel.add(deleteButton, "cell 7 0 1 3,alignx center,growy"); deleteButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png"))); deleteButton.setVerticalTextPosition(SwingConstants.BOTTOM); deleteButton.setHorizontalTextPosition(SwingConstants.CENTER); logButton = new JRibbonBigButton("Log"); logButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.log(); } }); vmPanel.add(logButton, "cell 6 0 1 3,alignx center,growy"); logButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/log.png"))); logButton.setVerticalTextPosition(SwingConstants.BOTTOM); logButton.setHorizontalTextPosition(SwingConstants.CENTER); hardRebootButton = new JRibbonButton("Hard reboot"); hardRebootButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VMMainPanel vmMainPanel = (VMMainPanel) mainContentPanel.getComponent(0); vmMainPanel.action("from titan: nova hard-reboot"); } }); hardRebootButton.setHorizontalAlignment(SwingConstants.LEFT); hardRebootButton .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/arrow_undo.png"))); ribbonSeparator = new JRibbonSeparator(); vmPanel.add(ribbonSeparator, "cell 5 0 1 3,alignx center,growy"); ribbonSeparator_1 = new JRibbonSeparator(); vmPanel.add(ribbonSeparator_1, "cell 8 0 1 3,alignx center,growy"); vmPanel.add(hardRebootButton, "cell 9 1,growx"); ribbonSeparator_2 = new JRibbonSeparator(); vmPanel.add(ribbonSeparator_2, "cell 11 0 1 3,grow"); macroButton = new JRibbonBigButton("Macro"); macroButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/code.png"))); macroButton.setVerticalTextPosition(SwingConstants.BOTTOM); macroButton.setHorizontalTextPosition(SwingConstants.CENTER); vmPanel.add(macroButton, "cell 12 0 1 3,growy"); snapshotButton = new JRibbonButton("Snapshot"); snapshotButton.setHorizontalAlignment(SwingConstants.LEFT); snapshotButton.setIcon( new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/application_cascade.png"))); vmPanel.add(snapshotButton, "cell 3 2,growx"); advanceButton = new JRibbonButton("Advance"); advanceButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); advanceButton.setHorizontalAlignment(SwingConstants.LEFT); advanceButton.setIcon(new ImageIcon( MainFrame.class.getResource("/com/titan/image/famfamfam/application_view_detail.png"))); vmPanel.add(advanceButton, "cell 9 2,growx"); executionMapButton = new JRibbonButton("Execution map"); executionMapButton.setIcon( new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/chart_organisation.png"))); executionMapButton.setHorizontalAlignment(SwingConstants.LEFT); vmPanel.add(executionMapButton, "cell 13 2,growx"); keystonePanel = new JRibbonPanel(); ribbonTabbedPane.addTab("Keystone", null, keystonePanel, null); keystonePanel.setLayout(new MigLayout("", "[][][][][][][][][][]", "[grow][][][][]")); addUserButton = new JRibbonBigButton("Add user"); addUserButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0); keystonePanel.addUser(); } }); addUserButton.setVerticalTextPosition(SwingConstants.BOTTOM); addUserButton.setHorizontalTextPosition(SwingConstants.CENTER); addUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/addUser.png"))); keystonePanel.add(addUserButton, "cell 0 0 1 3,growy"); editUserButton = new JRibbonButton("Edit user"); editUserButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); editUserButton.setHorizontalAlignment(SwingConstants.LEFT); editUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png"))); keystonePanel.add(editUserButton, "cell 1 0,growx"); changePasswordButton = new JRibbonButton("Change password"); keystonePanel.add(changePasswordButton, "cell 2 0"); ribbonSeparator_4 = new JRibbonSeparator(); keystonePanel.add(ribbonSeparator_4, "cell 3 0 1 3,growy"); addRoleButton = new JRibbonBigButton("Add role"); addRoleButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0); keystonePanel.addRole(); } }); addRoleButton.setVerticalTextPosition(SwingConstants.BOTTOM); addRoleButton.setHorizontalTextPosition(SwingConstants.CENTER); addRoleButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/addRole.png"))); keystonePanel.add(addRoleButton, "cell 4 0 1 3,growy"); deleteUserButton = new JRibbonButton("Delete user"); deleteUserButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); deleteUserButton.setHorizontalAlignment(SwingConstants.LEFT); deleteUserButton .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png"))); editRoleButton = new JRibbonButton("Edit role"); editRoleButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { } }); editRoleButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png"))); editRoleButton.setHorizontalAlignment(SwingConstants.LEFT); keystonePanel.add(editRoleButton, "cell 5 0,growx"); ribbonSeparator_5 = new JRibbonSeparator(); keystonePanel.add(ribbonSeparator_5, "cell 6 0 1 3,growy"); createTenantButton = new JRibbonBigButton("Create tenant"); createTenantButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0); keystonePanel.createTenant(); } }); createTenantButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png"))); createTenantButton.setVerticalTextPosition(SwingConstants.BOTTOM); createTenantButton.setHorizontalTextPosition(SwingConstants.CENTER); keystonePanel.add(createTenantButton, "cell 7 0 1 3,growy"); deleteTenantButton = new JRibbonBigButton("Delete tenant"); deleteTenantButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0); keystonePanel.deleteTenant(); } }); deleteTenantButton .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png"))); deleteTenantButton.setVerticalTextPosition(SwingConstants.BOTTOM); deleteTenantButton.setHorizontalTextPosition(SwingConstants.CENTER); keystonePanel.add(deleteTenantButton, "cell 8 0 1 3,growy"); keystonePanel.add(deleteUserButton, "cell 1 1,growx"); detailUserButton = new JRibbonButton("Detail user"); detailUserButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0); keystonePanel.showUserDetail(); } }); detailUserButton.setHorizontalAlignment(SwingConstants.LEFT); detailUserButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/zoom.png"))); keystonePanel.add(detailUserButton, "cell 1 2,growx"); btnDeleteRole = new JRibbonButton("Delete role"); btnDeleteRole.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0); keystonePanel.deleteRole(); } }); btnDeleteRole.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png"))); keystonePanel.add(btnDeleteRole, "cell 5 1,growx"); assignRoleButton = new JRibbonButton("Assign role"); assignRoleButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { KeystonePanel keystonePanel = (KeystonePanel) mainContentPanel.getComponent(0); keystonePanel.assignRole(); } }); assignRoleButton.setSelectedIcon( new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/user_add.png"))); keystonePanel.add(assignRoleButton, "cell 5 2,growx"); lblUser = new JRibbonLabel("user"); keystonePanel.add(lblUser, "cell 0 3 2 1,growx"); rbnlblRole = new JRibbonLabel("role"); keystonePanel.add(rbnlblRole, "cell 4 3 2 1,growx"); rbnlblTenant = new JRibbonLabel(); rbnlblTenant.setText("tenant"); keystonePanel.add(rbnlblTenant, "cell 7 3 2 1,growx"); flavorPanel = new JRibbonPanel(); ribbonTabbedPane.addTab("Flavor", null, flavorPanel, null); flavorPanel.setLayout(new MigLayout("", "[][]", "[grow][][][]")); rbnbgbtnCreateFlavor = new JRibbonBigButton(); rbnbgbtnCreateFlavor.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png"))); rbnbgbtnCreateFlavor.setText("Create Flavor"); flavorPanel.add(rbnbgbtnCreateFlavor, "cell 0 0 1 3,growy"); btnDeleteFlavor = new JRibbonBigButton("Delete Flavor"); btnDeleteFlavor.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/delete.png"))); flavorPanel.add(btnDeleteFlavor, "cell 1 0 1 3,growy"); storagePanel = new JRibbonPanel(); ribbonTabbedPane.addTab("Storage", null, storagePanel, null); storagePanel.setLayout(new MigLayout("", "[][][][][][]", "[grow][][][]")); uploadImageButton = new JRibbonBigButton("Upload"); uploadImageButton.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png"))); uploadImageButton.setVerticalTextPosition(SwingConstants.BOTTOM); uploadImageButton.setHorizontalTextPosition(SwingConstants.CENTER); storagePanel.add(uploadImageButton, "cell 0 0 1 3, growy"); btnDelete = new JRibbonButton("Delete"); btnDelete.setHorizontalAlignment(SwingConstants.LEFT); btnDelete.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png"))); storagePanel.add(btnDelete, "cell 1 0,growx"); ribbonSeparator_6 = new JRibbonSeparator(); storagePanel.add(ribbonSeparator_6, "cell 2 0 1 3,grow"); btnCreateVolume = new JRibbonBigButton("Create volume"); btnCreateVolume.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/add.png"))); btnCreateVolume.setVerticalTextPosition(SwingConstants.BOTTOM); btnCreateVolume.setHorizontalTextPosition(SwingConstants.CENTER); storagePanel.add(btnCreateVolume, "cell 3 0 1 3,growy"); btnDelete_1 = new JRibbonButton("Delete"); btnDelete_1.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png"))); btnDelete_1.setHorizontalAlignment(SwingConstants.LEFT); storagePanel.add(btnDelete_1, "cell 4 0,growx"); btnAttach = new JRibbonButton("Attach to vm"); btnAttach.setHorizontalAlignment(SwingConstants.LEFT); btnAttach.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/attach.png"))); storagePanel.add(btnAttach, "cell 5 0,growx"); btnChangeName = new JRibbonButton("Change name"); btnChangeName.setHorizontalAlignment(SwingConstants.LEFT); btnChangeName.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png"))); storagePanel.add(btnChangeName, "cell 1 1,growx"); btnDetail = new JRibbonButton("Detail"); btnDetail.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/zoom.png"))); btnDetail.setHorizontalAlignment(SwingConstants.LEFT); storagePanel.add(btnDetail, "cell 4 1,growx"); btnDetachToVm = new JRibbonButton("Detach to vm"); btnDetachToVm.setHorizontalAlignment(SwingConstants.LEFT); btnDetachToVm.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/delete.png"))); storagePanel.add(btnDetachToVm, "cell 5 1,growx"); btnPublicprivate = new JRibbonButton("public/private"); btnPublicprivate.setHorizontalAlignment(SwingConstants.LEFT); btnPublicprivate.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/tick.png"))); storagePanel.add(btnPublicprivate, "cell 1 2,growx"); btnAddVolumeType = new JRibbonButton("Add volume type"); btnAddVolumeType.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png"))); btnAddVolumeType.setHorizontalAlignment(SwingConstants.LEFT); storagePanel.add(btnAddVolumeType, "cell 4 2"); btnDeleteVolumeType = new JRibbonButton("Delete volume type"); btnDeleteVolumeType .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png"))); btnDeleteVolumeType.setHorizontalAlignment(SwingConstants.LEFT); storagePanel.add(btnDeleteVolumeType, "cell 5 2"); rbnlblImage = new JRibbonLabel(); rbnlblImage.setText("Image"); storagePanel.add(rbnlblImage, "cell 0 3 2 1,growx"); rbnlblVolume = new JRibbonLabel(); rbnlblVolume.setText("Volume"); storagePanel.add(rbnlblVolume, "cell 3 3 3 1,growx"); networkPanel = new JRibbonPanel(); ribbonTabbedPane.addTab("Network", null, networkPanel, null); settingPanel = new JRibbonPanel(); ribbonTabbedPane.addTab("Setting", null, settingPanel, null); settingPanel.setLayout(new MigLayout("", "[][][]", "[grow][grow][]")); rbnbgbtnSystemSetting = new JRibbonBigButton(); rbnbgbtnSystemSetting .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/systemSetting.png"))); rbnbgbtnSystemSetting.setText("System Setting"); settingPanel.add(rbnbgbtnSystemSetting, "cell 0 0 1 3,growy"); rbnbgbtnDatabase = new JRibbonBigButton(); rbnbgbtnDatabase .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/ribbon/database.png"))); rbnbgbtnDatabase.setText("Database"); settingPanel.add(rbnbgbtnDatabase, "cell 1 0 1 3,growy"); rbnbtnAddGroup = new JRibbonButton(); rbnbtnAddGroup.setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/add.png"))); rbnbtnAddGroup.setText("Add Group"); settingPanel.add(rbnbtnAddGroup, "cell 2 0"); rbnbtnEditGroup = new JRibbonButton(); rbnbtnEditGroup .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/pencil.png"))); rbnbtnEditGroup.setText("Edit Group"); settingPanel.add(rbnbtnEditGroup, "cell 2 1"); rbnbtnDeleteGroup = new JRibbonButton(); rbnbtnDeleteGroup .setIcon(new ImageIcon(MainFrame.class.getResource("/com/titan/image/famfamfam/cross.png"))); rbnbtnDeleteGroup.setText("Delete Group"); settingPanel.add(rbnbtnDeleteGroup, "cell 2 2"); logoPanel = new JRibbonPanel(); ribbonPanel.add(logoPanel, BorderLayout.WEST); logoPanel.setLayout(new BorderLayout(0, 0)); logoPanel.add(logoLabel, BorderLayout.CENTER); setLocationRelativeTo(null); new Thread(new TitanServerUpdateThread()).start(); }
From source file:de.tor.tribes.ui.views.DSWorkbenchTroopsFrame.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor./* w w w. j a va 2s .co m*/ */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { java.awt.GridBagConstraints gridBagConstraints; jXTroopsPanel = new org.jdesktop.swingx.JXPanel(); jTroopsTabPane = new javax.swing.JTabbedPane(); jxSearchPane = new org.jdesktop.swingx.JXPanel(); jXPanel2 = new org.jdesktop.swingx.JXPanel(); jButton12 = new javax.swing.JButton(); jFilterRows = new javax.swing.JCheckBox(); jScrollPane4 = new javax.swing.JScrollPane(); jXGroupsList = new org.jdesktop.swingx.JXList(); jLabel22 = new javax.swing.JLabel(); jRelationType1 = new javax.swing.JCheckBox(); jTroopsAddDialog = new javax.swing.JDialog(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jTroopAddTribe = new javax.swing.JComboBox(); jTroopAddVillage = new javax.swing.JComboBox(); jApplyTroopAddButton = new javax.swing.JButton(); jButton2 = new javax.swing.JButton(); jTroopsInformationAlwaysOnTop = new javax.swing.JCheckBox(); jTroopsPanel = new javax.swing.JPanel(); capabilityInfoPanel1 = new de.tor.tribes.ui.components.CapabilityInfoPanel(); jXTroopsPanel.setMinimumSize(new java.awt.Dimension(700, 500)); jXTroopsPanel.setPreferredSize(new java.awt.Dimension(700, 500)); jXTroopsPanel.setLayout(new java.awt.BorderLayout()); jXTroopsPanel.add(jTroopsTabPane, java.awt.BorderLayout.CENTER); jxSearchPane.setOpaque(false); jxSearchPane.setLayout(new java.awt.GridBagLayout()); jXPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder()); jXPanel2.setInheritAlpha(false); jButton12.setText("Anwenden"); jButton12.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(java.awt.event.MouseEvent evt) { fireHideGlassPaneEvent(evt); } }); jFilterRows.setText("Nur gefilterte Zeilen anzeigen"); jFilterRows.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { jFilterRowsfireUpdateFilterEvent(evt); } }); jXGroupsList.setModel(new javax.swing.AbstractListModel() { String[] strings = { "Item 1", "Item 2", "Item 3", "Item 4", "Item 5" }; public int getSize() { return strings.length; } public Object getElementAt(int i) { return strings[i]; } }); jScrollPane4.setViewportView(jXGroupsList); jLabel22.setText("Gruppen"); jRelationType1.setSelected(true); jRelationType1.setText("Verknpfung"); jRelationType1.setToolTipText( "Verknpfung der gewhlten Dorfgruppen (UND = Dorf muss in allen Gruppen sein, ODER = Dorf muss in mindestens einer Gruppe sein)"); jRelationType1.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); jRelationType1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/res/ui/logic_or.png"))); // NOI18N jRelationType1.setRolloverEnabled(false); jRelationType1.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/res/ui/logic_and.png"))); // NOI18N jRelationType1.addItemListener(new java.awt.event.ItemListener() { public void itemStateChanged(java.awt.event.ItemEvent evt) { fireRelationChangedEvent(evt); } }); javax.swing.GroupLayout jXPanel2Layout = new javax.swing.GroupLayout(jXPanel2); jXPanel2.setLayout(jXPanel2Layout); jXPanel2Layout.setHorizontalGroup(jXPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jXPanel2Layout.createSequentialGroup().addContainerGap().addComponent(jLabel22) .addGap(18, 18, 18) .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jXPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addComponent(jRelationType1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE) .addComponent(jFilterRows, javax.swing.GroupLayout.PREFERRED_SIZE, 215, Short.MAX_VALUE) .addComponent(jButton12)) .addContainerGap())); jXPanel2Layout .setVerticalGroup(jXPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jXPanel2Layout.createSequentialGroup().addContainerGap().addGroup(jXPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addGroup(jXPanel2Layout.createSequentialGroup() .addGroup(jXPanel2Layout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel22).addComponent(jRelationType1)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(jFilterRows) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButton12)) .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 190, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap())); jxSearchPane.add(jXPanel2, new java.awt.GridBagConstraints()); jTroopsAddDialog.setTitle("Truppen hinzufgen"); jTroopsAddDialog.setModal(true); jTroopsAddDialog.getContentPane().setLayout(new java.awt.GridBagLayout()); jLabel1.setText("Spieler"); jLabel1.setMaximumSize(new java.awt.Dimension(60, 14)); jLabel1.setMinimumSize(new java.awt.Dimension(60, 14)); jLabel1.setPreferredSize(new java.awt.Dimension(60, 14)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jTroopsAddDialog.getContentPane().add(jLabel1, gridBagConstraints); jLabel2.setText("Dorf"); jLabel2.setMaximumSize(new java.awt.Dimension(60, 14)); jLabel2.setMinimumSize(new java.awt.Dimension(60, 14)); jLabel2.setPreferredSize(new java.awt.Dimension(60, 14)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jTroopsAddDialog.getContentPane().add(jLabel2, gridBagConstraints); jTroopAddTribe.setModel( new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); jTroopAddTribe.setMinimumSize(new java.awt.Dimension(200, 25)); jTroopAddTribe.setPreferredSize(new java.awt.Dimension(200, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 0; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jTroopsAddDialog.getContentPane().add(jTroopAddTribe, gridBagConstraints); jTroopAddVillage.setModel( new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" })); jTroopAddVillage.setMinimumSize(new java.awt.Dimension(200, 20)); jTroopAddVillage.setPreferredSize(new java.awt.Dimension(200, 25)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 1; gridBagConstraints.gridwidth = 2; gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jTroopsAddDialog.getContentPane().add(jTroopAddVillage, gridBagConstraints); jApplyTroopAddButton.setText("Hinzufgen"); jApplyTroopAddButton.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(java.awt.event.MouseEvent evt) { fireApplyTroopAddEvent(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 2; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jTroopsAddDialog.getContentPane().add(jApplyTroopAddButton, gridBagConstraints); jButton2.setText("Abbrechen"); jButton2.addMouseListener(new java.awt.event.MouseAdapter() { public void mouseReleased(java.awt.event.MouseEvent evt) { fireApplyTroopAddEvent(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 1; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHEAST; gridBagConstraints.weightx = 1.0; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); jTroopsAddDialog.getContentPane().add(jButton2, gridBagConstraints); setTitle("Truppen"); getContentPane().setLayout(new java.awt.GridBagLayout()); jTroopsInformationAlwaysOnTop.setText("Immer im Vordergrund"); jTroopsInformationAlwaysOnTop.addChangeListener(new javax.swing.event.ChangeListener() { public void stateChanged(javax.swing.event.ChangeEvent evt) { fireTroopsFrameOnTopEvent(evt); } }); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); getContentPane().add(jTroopsInformationAlwaysOnTop, gridBagConstraints); jTroopsPanel.setBackground(new java.awt.Color(239, 235, 223)); jTroopsPanel.setMinimumSize(new java.awt.Dimension(700, 500)); jTroopsPanel.setPreferredSize(new java.awt.Dimension(700, 500)); jTroopsPanel.setLayout(new java.awt.BorderLayout()); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 1.0; gridBagConstraints.weighty = 1.0; getContentPane().add(jTroopsPanel, gridBagConstraints); capabilityInfoPanel1.setCopyable(false); capabilityInfoPanel1.setPastable(false); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); getContentPane().add(capabilityInfoPanel1, gridBagConstraints); pack(); }
From source file:edu.harvard.i2b2.query.QueryConceptTreePanel.java
/** This method is called from within the constructor to * initialize the form.//from w w w. ja va 2s. com */ private void initComponents() { jScrollPane1 = new javax.swing.JScrollPane(); jClearButton = new javax.swing.JButton(); jConstrainButton = new javax.swing.JButton(); jExcludeButton = new javax.swing.JButton(); jOccurrenceButton = new javax.swing.JButton(); jNameLabel = new javax.swing.JLabel(); setLayout(null); QueryConceptTreeNodeData tmpData = new QueryConceptTreeNodeData(); tmpData.name("working ......"); tmpData.tooltip("A root node"); tmpData.visualAttribute("FAO"); top = new DefaultMutableTreeNode(tmpData); //top = new DefaultMutableTreeNode("Root Node"); treeModel = new DefaultTreeModel(top); //treeModel.addTreeModelListener(new MyTreeModelListener()); jTree1 = new JTree(treeModel); jTree1.setEditable(true); //jTree1.getSelectionModel().setSelectionMode // (TreeSelectionModel.SINGLE_TREE_SELECTION); //jTree1.setShowsRootHandles(true); //JScrollPane treeView = new JScrollPane(jTree1); jTree1.setRootVisible(false); jTree1.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); jTree1.setCellRenderer(new MyRenderer()); ToolTipManager.sharedInstance().registerComponent(jTree1); setBorder(javax.swing.BorderFactory.createEtchedBorder()); add(jScrollPane1); //jScrollPane1.setBounds(0, 40, 180, 200); jClearButton.setFont(new java.awt.Font("Tahoma", 1, 11)); jClearButton.setText("X"); jClearButton.setToolTipText("Clear all items from panel"); jClearButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); jClearButton.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); jClearButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); jClearButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jClearButtonActionPerformed(evt); } }); add(jClearButton); jClearButton.setBounds(160, 0, 18, 20); jConstrainButton.setText("Dates"); jConstrainButton.setToolTipText("Constrain group by dates"); jConstrainButton.setHorizontalTextPosition(javax.swing.SwingConstants.LEFT); jConstrainButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); jConstrainButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jConstrainButtonActionPerformed(evt); } }); add(jConstrainButton); jConstrainButton.setBounds(0, 20, 40, 21); jOccurrenceButton.setText("Occurs > 0x"); jOccurrenceButton.setToolTipText("Set occurrence times"); jOccurrenceButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jOccurrenceButton.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jOccurrenceButton.setMargin(new java.awt.Insets(6, 6, 6, 6)); jOccurrenceButton.setIconTextGap(0); jOccurrenceButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jOccurrenceButtonActionPerformed(evt); } }); add(jOccurrenceButton); jOccurrenceButton.setBounds(40, 20, 90, 21); //jExcludeButton.setMnemonic('E'); jExcludeButton.setText("Exclude"); jExcludeButton.setToolTipText("Exclude all items in group"); jExcludeButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); jExcludeButton.setMargin(new java.awt.Insets(2, 2, 2, 2)); jExcludeButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jExcludeButtonActionPerformed(evt); } }); add(jExcludeButton); jExcludeButton.setBounds(130, 20, 48, 21); jExcludeButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT); jNameLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jNameLabel.setText("Group 1"); jNameLabel.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jNameLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER); add(jNameLabel); jNameLabel.setBounds(0, 0, 160, 20); jTree1.addTreeExpansionListener(this); jTree1.setTransferHandler(new TextHandler()); add(jScrollPane1); jScrollPane1.setViewportView(jTree1); //jTree1.setToolTipText("Double click on a folder to view the items inside"); //jScrollPane1.getViewport().setToolTipText("Double click on a folder to view the items inside"); jScrollPane1.setBounds(0, 40, 180, 160); }
From source file:edu.ku.brc.specify.tasks.subpane.wb.TemplateEditor.java
@Override public void createUI() { super.createUI(); databaseSchema = WorkbenchTask.getDatabaseSchema(); int disciplineeId = AppContextMgr.getInstance().getClassObject(Discipline.class).getDisciplineId(); SchemaI18NService.getInstance().loadWithLocale(SpLocaleContainer.WORKBENCH_SCHEMA, disciplineeId, databaseSchema, SchemaI18NService.getCurrentLocale()); // Create the Table List Vector<TableInfo> tableInfoList = new Vector<TableInfo>(); for (DBTableInfo ti : databaseSchema.getTables()) { if (StringUtils.isNotEmpty(ti.toString())) { TableInfo tableInfo = new TableInfo(ti, IconManager.STD_ICON_SIZE); tableInfoList.add(tableInfo); Vector<FieldInfo> fldList = new Vector<FieldInfo>(); for (DBFieldInfo fi : ti.getFields()) { String fldTitle = fi.getTitle().replace(" ", ""); if (fldTitle.equalsIgnoreCase(fi.getName())) { //get title from mapped field UploadInfo upInfo = getUploadInfo(fi); DBFieldInfo mInfo = getMappedFieldInfo(fi); if (mInfo != null) { String title = mInfo.getTitle(); if (upInfo != null && upInfo.getSequence() != -1) { title += " " + (upInfo.getSequence() + 1); }/*w w w . j a v a 2 s . c o m*/ //if mapped-to table is different than the container table used // in the wb, add the mapped-to table's title if (mInfo.getTableInfo().getTableId() != ti.getTableId()) { title = mInfo.getTableInfo().getTitle() + " " + title; } fi.setTitle(title); } } fldList.add(new FieldInfo(ti, fi)); } //Collections.sort(fldList); tableInfo.setFieldItems(fldList); } } Collections.sort(tableInfoList); fieldModel = new DefaultModifiableListModel<FieldInfo>(); tableModel = new DefaultModifiableListModel<TableInfo>(); for (TableInfo ti : tableInfoList) { tableModel.add(ti); // only added for layout for (FieldInfo fi : ti.getFieldItems()) { fieldModel.add(fi); } } tableList = new JList(tableModel); tableList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tableList.setCellRenderer(tableInfoListRenderer = new TableInfoListRenderer(IconManager.STD_ICON_SIZE)); JScrollPane tableScrollPane = new JScrollPane(tableList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); tableList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { Object selObj = tableList.getSelectedValue(); if (selObj != null) { fillFieldList((TableInfo) selObj); } updateEnabledState(); } } }); fieldList = new JList(fieldModel); fieldList.setCellRenderer(tableInfoListRenderer = new TableInfoListRenderer(IconManager.STD_ICON_SIZE)); fieldList.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION); JScrollPane fieldScrollPane = new JScrollPane(fieldList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); fieldList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { updateEnabledState(); updateFieldDescription(); } } }); mapModel = new DefaultModifiableListModel<FieldMappingPanel>(); mapList = new JList(mapModel); mapList.setCellRenderer(new MapCellRenderer()); mapList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); mapScrollPane = new JScrollPane(mapList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); mapList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { FieldMappingPanel fmp = (FieldMappingPanel) mapList.getSelectedValue(); if (fmp != null) { ignoreMapListUpdate = true; FieldInfo fldInfo = fmp.getFieldInfo(); if (fldInfo != null) { for (int i = 0; i < tableModel.size(); i++) { TableInfo tblInfo = (TableInfo) tableModel.get(i); if (fldInfo.getTableinfo() == tblInfo.getTableInfo()) { tableList.setSelectedValue(tblInfo, true); fillFieldList(tblInfo); //System.out.println(fldInfo.hashCode()+" "+fldInfo.getFieldInfo().hashCode()); fieldList.setSelectedValue(fldInfo, true); updateFieldDescription(); break; } } } ignoreMapListUpdate = false; updateEnabledState(); } } } }); upBtn = createIconBtn("ReorderUp", "WB_MOVE_UP", new ActionListener() { public void actionPerformed(ActionEvent ae) { int inx = mapList.getSelectedIndex(); FieldMappingPanel fmp = mapModel.getElementAt(inx); mapModel.remove(fmp); mapModel.insertElementAt(fmp, inx - 1); mapList.setSelectedIndex(inx - 1); updateEnabledState(); setChanged(true); } }); downBtn = createIconBtn("ReorderDown", "WB_MOVE_DOWN", new ActionListener() { public void actionPerformed(ActionEvent ae) { int inx = mapList.getSelectedIndex(); FieldMappingPanel fmp = mapModel.getElementAt(inx); mapModel.remove(fmp); mapModel.insertElementAt(fmp, inx + 1); mapList.setSelectedIndex(inx + 1); updateEnabledState(); setChanged(true); } }); JButton dumpMappingBtn = createIconBtn("BlankIcon", IconManager.IconSize.Std16, "WB_MAPPING_DUMP", new ActionListener() { public void actionPerformed(ActionEvent ae) { dumpMapping(); } }); dumpMappingBtn.setEnabled(true); dumpMappingBtn.setFocusable(false); dumpMappingBtn.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent e) { ((JButton) e.getSource()).setIcon(IconManager.getIcon("Save", IconManager.IconSize.Std16)); super.mouseEntered(e); } @Override public void mouseExited(MouseEvent e) { ((JButton) e.getSource()).setIcon(IconManager.getIcon("BlankIcon", IconManager.IconSize.Std16)); super.mouseExited(e); } }); mapToBtn = createIconBtn("Map", "WB_ADD_MAPPING_ITEM", new ActionListener() { public void actionPerformed(ActionEvent ae) { map(); } }); unmapBtn = createIconBtn("Unmap", "WB_REMOVE_MAPPING_ITEM", new ActionListener() { public void actionPerformed(ActionEvent ae) { unmap(); } }); // Adjust all Labels depending on whether we are creating a new template or not // and whether it is from a file or not String mapListLeftLabel; String mapListRightLabel; // Note: if workbenchTemplate is null then it is String dataTypeLabel = getResourceString("WB_DATA_TYPE"); String fieldsLabel = getResourceString("WB_FIELDS"); mapListLeftLabel = fieldsLabel; mapListRightLabel = getResourceString("WB_COLUMNS"); CellConstraints cc = new CellConstraints(); JPanel mainLayoutPanel = new JPanel(); PanelBuilder labelsBldr = new PanelBuilder(new FormLayout("p, f:p:g, p", "p")); labelsBldr.add(createLabel(mapListLeftLabel, SwingConstants.LEFT), cc.xy(1, 1)); labelsBldr.add(createLabel(mapListRightLabel, SwingConstants.RIGHT), cc.xy(3, 1)); PanelBuilder upDownPanel = new PanelBuilder(new FormLayout("p", "p,f:p:g, p, 2px, p, f:p:g")); upDownPanel.add(dumpMappingBtn, cc.xy(1, 1)); upDownPanel.add(upBtn, cc.xy(1, 3)); upDownPanel.add(downBtn, cc.xy(1, 5)); PanelBuilder middlePanel = new PanelBuilder(new FormLayout("c:p:g", "p, 2px, p")); middlePanel.add(mapToBtn, cc.xy(1, 1)); middlePanel.add(unmapBtn, cc.xy(1, 3)); btnPanel = middlePanel.getPanel(); btnPanel.setOpaque(false); PanelBuilder outerMiddlePanel = new PanelBuilder(new FormLayout("c:p:g", "f:p:g, p, f:p:g")); outerMiddlePanel.add(btnPanel, cc.xy(1, 2)); outerMiddlePanel.getPanel().setOpaque(false); // Main Pane Layout PanelBuilder builder = new PanelBuilder( new FormLayout("f:max(200px;p):g, 5px, max(200px;p), 5px, p:g, 5px, f:max(250px;p):g, 2px, p", "p, 2px, f:max(350px;p):g"), mainLayoutPanel); builder.add(createLabel(dataTypeLabel, SwingConstants.CENTER), cc.xy(1, 1)); builder.add(createLabel(fieldsLabel, SwingConstants.CENTER), cc.xy(3, 1)); builder.add(labelsBldr.getPanel(), cc.xy(7, 1)); builder.add(tableScrollPane, cc.xy(1, 3)); builder.add(fieldScrollPane, cc.xy(3, 3)); builder.add(outerMiddlePanel.getPanel(), cc.xy(5, 3)); builder.add(mapScrollPane, cc.xy(7, 3)); builder.add(upDownPanel.getPanel(), cc.xy(9, 3)); mainLayoutPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel megaPanel = new JPanel(new BorderLayout()); megaPanel.add(mainLayoutPanel, BorderLayout.CENTER); descriptionLbl = createLabel(" ", SwingConstants.LEFT); //PanelBuilder descBuilder = new PanelBuilder(new FormLayout("f:p:g, 3dlu","p")); //descBuilder.add(descriptionLbl, cc.xy(1, 1)); //megaPanel.add(descBuilder.getPanel(), BorderLayout.SOUTH); megaPanel.add(descriptionLbl, BorderLayout.SOUTH); //contentPanel = mainLayoutPanel; contentPanel = megaPanel; Color bgColor = btnPanel.getBackground(); int inc = 16; btnPanelColor = new Color(Math.min(255, bgColor.getRed() + inc), Math.min(255, bgColor.getGreen() + inc), Math.min(255, bgColor.getBlue() + inc)); btnPanel.setBackground(btnPanelColor); btnPanel.setBorder(BorderFactory.createEmptyBorder(4, 6, 4, 6)); okBtn.setEnabled(false); HelpMgr.registerComponent(helpBtn, helpContext); if (dataFileInfo != null) { autoMapFromDataFile(dataFileInfo.getColInfo()); } if (workbenchTemplate != null) { fillFromTemplate(); setChanged(false); } mainPanel.add(contentPanel, BorderLayout.CENTER); if (dataFileInfo == null) //can't add new mappings when importing. { FieldMappingPanel fmp = addMappingItem(null, IconManager.getIcon("BlankIcon", IconManager.STD_ICON_SIZE), null); fmp.setAdded(true); fmp.setNew(true); } pack(); SwingUtilities.invokeLater(new Runnable() { @SuppressWarnings("synthetic-access") public void run() { cancelBtn.requestFocus(); fieldModel.clear(); fieldList.clearSelection(); updateFieldDescription(); updateEnabledState(); if (mapModel.size() > 1) { mapList.clearSelection(); } } }); }
From source file:com.rapidminer.gui.properties.RegexpPropertyDialog.java
public RegexpPropertyDialog(final Collection<String> items, String predefinedRegexp, String description) { super(ApplicationFrame.getApplicationFrame(), "parameter.regexp", ModalityType.APPLICATION_MODAL, new Object[] {}); this.items = items; this.supportsItems = items != null; this.infoText = "<html>" + I18N.getMessage(I18N.getGUIBundle(), getKey() + ".title") + ": <br/>" + description + "</html>"; Dimension size = new Dimension(420, 500); this.setMinimumSize(size); this.setPreferredSize(size); JPanel panel = new JPanel(createGridLayout(1, supportsItems ? 2 : 1)); // create regexp text field regexpTextField = new JTextField(predefinedRegexp); regexpTextField.setToolTipText(//from w w w. j a v a 2 s.co m I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.tip")); regexpTextField.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { fireRegularExpressionUpdated(); } @Override public void keyTyped(KeyEvent e) { } }); regexpTextField.requestFocus(); // create replacement text field replacementTextField = new JTextField(); replacementTextField.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.replacement.tip")); replacementTextField.addKeyListener(new KeyListener() { @Override public void keyPressed(KeyEvent e) { } @Override public void keyReleased(KeyEvent e) { fireRegularExpressionUpdated(); } @Override public void keyTyped(KeyEvent e) { } }); // create inline search documents inlineSearchDocument = new RegexpSearchStyledDocument(); inlineReplaceDocument = new RegexpReplaceStyledDocument(); // create search results list DefaultListCellRenderer resultCellRenderer = new DefaultListCellRenderer() { private static final long serialVersionUID = 1L; @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); setBackground(list.getBackground()); setForeground(list.getForeground()); setBorder(getNoFocusBorder()); return this; } private Border getNoFocusBorder() { Border border = BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray); return border; } }; JList<RegExpResult> regexpFindingsList = new JList<RegExpResult>(resultsListModel); regexpFindingsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); regexpFindingsList.setLayoutOrientation(JList.VERTICAL); regexpFindingsList.setCellRenderer(resultCellRenderer); // regexp panel on left side of dialog JPanel regexpPanel = new JPanel(new GridBagLayout()); regexpPanel.setBorder(createTitledBorder( I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.border"))); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(4, 4, 4, 0); c.gridx = 0; c.gridy = 0; c.weightx = 1; c.fill = GridBagConstraints.BOTH; regexpPanel.add(regexpTextField, c); // make shortcut button final Action nullAction = new DefaultAction(); PlainArrowDropDownButton autoWireDropDownButton = PlainArrowDropDownButton.makeDropDownButton(nullAction); for (String[] popupItem : (String[][]) ArrayUtils.addAll(regexpConstructs, regexpShortcuts)) { String shortcut = popupItem[0].length() > 14 ? popupItem[0].substring(0, 14) + "..." : popupItem[0]; autoWireDropDownButton .add(new InsertionAction("<html><table border=0 cellpadding=0 cellspacing=0><tr><td width=100>" + shortcut + "</td><td>" + popupItem[1] + "</td></tr></table></html>", popupItem[0])); } c.insets = new Insets(4, 0, 4, 0); c.gridx = 1; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; regexpPanel.add(autoWireDropDownButton.getDropDownArrowButton(), c); // make delete button c.insets = new Insets(4, 0, 4, 4); c.gridx = 2; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; JButton clearRegexpTextFieldButton = new JButton(SwingTools.createIcon("16/delete2.png")); clearRegexpTextFieldButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { regexpTextField.setText(""); fireRegularExpressionUpdated(); regexpTextField.requestFocusInWindow(); } }); regexpPanel.add(clearRegexpTextFieldButton, c); errorMessage = new JLabel(NO_ERROR_MESSAGE, NO_ERROR_ICON, SwingConstants.LEFT); errorMessage.setFocusable(false); c.insets = new Insets(4, 8, 4, 4); c.gridx = 0; c.gridy = 1; c.weightx = 0; c.weighty = 0; c.gridwidth = GridBagConstraints.REMAINDER; regexpPanel.add(errorMessage, c); // create replacement panel JPanel replacementPanel = new JPanel(new GridBagLayout()); replacementPanel.setBorder(createTitledBorder( I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.replacement.border"))); JPanel testerPanel = new JPanel(new GridBagLayout()); c.insets = new Insets(4, 4, 4, 0); c.gridx = 0; c.gridy = 0; c.weightx = 1; c.fill = GridBagConstraints.HORIZONTAL; replacementPanel.add(replacementTextField, c); // create inline search panel JPanel inlineSearchPanel = new JPanel(new GridBagLayout()); c.insets = new Insets(8, 4, 4, 4); c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; inlineSearchPanel.add( new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.inline_search.search")), c); c.insets = new Insets(0, 0, 0, 0); c.gridx = 0; c.gridy = 1; c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.BOTH; inlineSearchPanel.add(new JScrollPane(new JTextPane(inlineSearchDocument)), c); c.insets = new Insets(8, 4, 4, 4); c.gridx = 0; c.gridy = 2; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; inlineSearchPanel.add( new JLabel( I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.inline_search.replaced")), c); c.insets = new Insets(0, 0, 0, 0); c.gridx = 0; c.gridy = 3; c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.BOTH; JTextPane replaceTextPane = new JTextPane(inlineReplaceDocument); replaceTextPane.setEditable(false); inlineSearchPanel.add(new JScrollPane(replaceTextPane), c); // create regexp options panel ItemListener defaultOptionListener = new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { fireRegexpOptionsChanged(); } }; cbCaseInsensitive = new JCheckBox(I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.regexp_options.case_insensitive")); cbCaseInsensitive.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.regexp_options.case_insensitive.tip")); cbCaseInsensitive.addItemListener(defaultOptionListener); cbMultiline = new JCheckBox(I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.regexp_options.multiline_mode")); cbMultiline.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.regexp_options.multiline_mode.tip")); cbMultiline.addItemListener(defaultOptionListener); cbDotall = new JCheckBox(I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.regexp_options.dotall_mode")); cbDotall.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.regexp_options.dotall_mode.tip")); cbDotall.addItemListener(defaultOptionListener); cbUnicodeCase = new JCheckBox(I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.regexp_options.unicode_case")); cbUnicodeCase.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.regexp_options.unicode_case.tip")); cbUnicodeCase.addItemListener(defaultOptionListener); JPanel regexpOptionsPanelWrapper = new JPanel(new BorderLayout()); JPanel regexpOptionsPanel = new JPanel(new GridBagLayout()); regexpOptionsPanelWrapper.add(regexpOptionsPanel, BorderLayout.NORTH); c.insets = new Insets(12, 4, 0, 4); c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; regexpOptionsPanel.add(cbMultiline, c); c.insets = new Insets(8, 4, 0, 4); c.gridy = 1; regexpOptionsPanel.add(cbCaseInsensitive, c); c.gridy = 2; regexpOptionsPanel.add(cbUnicodeCase, c); c.gridy = 3; regexpOptionsPanel.add(cbDotall, c); // create tabbed panel c.insets = new Insets(8, 4, 4, 4); c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 1; c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.BOTH; testExp = new JTabbedPane(); testExp.add( I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.inline_search.title"), new JScrollPane(inlineSearchPanel)); testExp.add( I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.result_list.title"), new JScrollPane(regexpFindingsList)); testExp.add( I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.regexp_options.title"), regexpOptionsPanelWrapper); testerPanel.add(testExp, c); JPanel groupPanel = new JPanel(new GridBagLayout()); c.insets = new Insets(4, 4, 4, 4); c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; groupPanel.add(regexpPanel, c); c.insets = new Insets(4, 4, 4, 4); c.gridx = 0; c.gridy = 1; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; groupPanel.add(replacementPanel, c); c.insets = new Insets(4, 4, 4, 4); c.gridx = 0; c.gridy = 2; c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.BOTH; groupPanel.add(testerPanel, c); panel.add(groupPanel, 1, 0); if (supportsItems) { // item shortcuts list itemShortcutsList = new JList<String>(items.toArray(new String[items.size()])); itemShortcutsList.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.item_shortcuts.tip")); itemShortcutsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); itemShortcutsList.addMouseListener(new MouseListener() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { String text = regexpTextField.getText(); int cursorPosition = regexpTextField.getCaretPosition(); int index = itemShortcutsList.getSelectedIndex(); if (index > -1 && index < itemShortcutsList.getModel().getSize()) { String insertionString = itemShortcutsList.getModel().getElementAt(index).toString(); String newText = text.substring(0, cursorPosition) + insertionString + (cursorPosition < text.length() ? text.substring(cursorPosition) : ""); regexpTextField.setText(newText); regexpTextField.setCaretPosition(cursorPosition + insertionString.length()); regexpTextField.requestFocus(); fireRegularExpressionUpdated(); } } } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseReleased(MouseEvent e) { } }); JScrollPane itemShortcutsPane = new JScrollPane(itemShortcutsList); itemShortcutsPane.setBorder(createTitledBorder( I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.item_shortcuts.border"))); // matched items list matchedItemsListModel = new DefaultListModel<String>(); JList<String> matchedItemsList = new JList<String>(matchedItemsListModel); matchedItemsList.setToolTipText( I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.matched_items.tip")); // add custom cell renderer to disallow selections matchedItemsList.setCellRenderer(new DefaultListCellRenderer() { private static final long serialVersionUID = -5795848004756768378L; @Override public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { return super.getListCellRendererComponent(list, value, index, false, false); } }); JScrollPane matchedItemsPanel = new JScrollPane(matchedItemsList); matchedItemsPanel.setBorder(createTitledBorder( I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.matched_items.border"))); // item panel on right side of dialog JPanel itemPanel = new JPanel(createGridLayout(1, 2)); itemPanel.add(itemShortcutsPane, 0, 0); itemPanel.add(matchedItemsPanel, 0, 1); panel.add(itemPanel, 0, 1); } okButton = makeOkButton("regexp_property_dialog_apply"); fireRegularExpressionUpdated(); layoutDefault(panel, supportsItems ? NORMAL : NARROW, okButton, makeCancelButton()); }
From source file:es.ubu.XRayDetector.interfaz.PanelAplicacion.java
/** * Gets the analyze button./*from ww w .ja va 2 s . com*/ * * @param panelControl The control panel. */ private void getBtnAnalizar(JPanel panelControl) { btnAnalizar = new JButton("Analizar imagen"); btnAnalizar.setToolTipText("Inicia el proceso de an\u00E1lisis sobre la imagen"); btnAnalizar.setEnabled(false); btnAnalizar.addActionListener(new AnalizarImagenListener()); btnAnalizar.setIcon(new ImageIcon("./res/img/app/play.png")); btnAnalizar.setHorizontalTextPosition(SwingConstants.LEFT); btnAnalizar.setIconTextGap(10); panelControl.add(btnAnalizar); }
From source file:net.sf.dvstar.transmission.TransmissionView.java
private void setAdditionalButtons() { ResizableIcon ri = new ArrowResizableIcon(9, SwingConstants.SOUTH); JCommandButton dropDownButton = new JCommandButton("Text Button", ri); ImageIcon imco = globalResourceMap.getImageIcon("btExit.icon"); Dimension idim = new Dimension(imco.getIconWidth(), imco.getIconHeight()); idim = new Dimension(40, 40); Image im = imco.getImage();/* w ww. ja v a 2 s.com*/ ImageWrapperResizableIcon iwri = ImageWrapperResizableIcon.getIcon(im, idim); JCommandButton taskbarButtonPaste = new JCommandButton("", iwri); taskbarButtonPaste.setHorizontalAlignment(SwingConstants.LEFT); taskbarButtonPaste.setCommandButtonKind(CommandButtonKind.ACTION_AND_POPUP_MAIN_POPUP); //taskbarButtonPaste.setPopupOrientationKind(CommandButtonPopupOrientationKind.DOWNWARD); taskbarButtonPaste.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); taskbarButtonPaste.setDisplayState(TILE_36); // !!!! //taskbarButtonPaste.setPreferredSize(new Dimension(80, 48)); System.out.println("Pref " + taskbarButtonPaste.getPreferredSize()); System.out.println("Maxi " + taskbarButtonPaste.getMaximumSize()); System.out.println("Mini " + taskbarButtonPaste.getMinimumSize()); System.out.println("Size " + taskbarButtonPaste.getSize()); Dimension d = new Dimension(taskbarButtonPaste.getPreferredSize().width, 48); taskbarButtonPaste.setMaximumSize(d); taskbarButtonPaste.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { System.out.println("Taskbar Paste activated"); } }); taskbarButtonPaste.setPopupCallback(new PopupPanelCallback() { @Override public JPopupPanel getPopupPanel(JCommandButton commandButton) { return new SamplePopupMenu(); } }); taskbarButtonPaste.setActionRichTooltip(new RichTooltip("Paste", "Paste the contents of the Clipboard")); taskbarButtonPaste.setPopupRichTooltip(new RichTooltip("Paste", "Click here for more options such as pasting only the values or formatting")); taskbarButtonPaste.setActionKeyTip("1"); //maiToolBar.add( rb ); /* JRibbonBand rb = new JRibbonBand("", new EmptyResizableIcon(1)); rb.addCommandButton(dropDownButton, RibbonElementPriority.MEDIUM); * JButton dropDownButton = DropDownButtonFactory.createDropDownButton( resourceMap.getIcon("btConnect.icon"), popup); */ //dropDownButton.setBorder(javax.swing.BorderFactory.createEmptyBorder(2,2,2,2)); //dropDownButton.setBorderPainted( false ); //btConnect = taskbarButtonPaste; maiToolBar.add(taskbarButtonPaste); }