List of usage examples for javax.swing JLabel setIcon
@BeanProperty(preferred = true, visualUpdate = true, description = "The icon this component will display.") public void setIcon(Icon icon)
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 ww .j a v a 2s . c o m 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:filterviewplugin.FilterViewSettingsTab.java
public JPanel createSettingsPanel() { final EnhancedPanelBuilder panelBuilder = new EnhancedPanelBuilder(FormFactory.RELATED_GAP_COLSPEC.encode() + ',' + FormFactory.PREF_COLSPEC.encode() + ',' + FormFactory.RELATED_GAP_COLSPEC.encode() + ',' + FormFactory.PREF_COLSPEC.encode() + ", fill:default:grow"); final CellConstraints cc = new CellConstraints(); final JLabel label = new JLabel(mLocalizer.msg("daysToShow", "Days to show")); panelBuilder.addRow();// w ww. ja va 2 s .c om panelBuilder.add(label, cc.xy(2, panelBuilder.getRow())); final SpinnerNumberModel model = new SpinnerNumberModel(3, 1, 7, 1); mSpinner = new JSpinner(model); mSpinner.setValue(mSettings.getDays()); panelBuilder.add(mSpinner, cc.xy(4, panelBuilder.getRow())); panelBuilder.addParagraph(mLocalizer.msg("filters", "Filters to show")); mFilterList = new SelectableItemList(mSettings.getActiveFilterNames(), FilterViewSettings.getAvailableFilterNames()); mIcons.clear(); for (String filterName : FilterViewSettings.getAvailableFilterNames()) { mIcons.put(filterName, mSettings.getFilterIconName(mSettings.getFilter(filterName))); } mFilterList.addCenterRendererComponent(String.class, new SelectableItemRendererCenterComponentIf() { private DefaultListCellRenderer mRenderer = new DefaultListCellRenderer(); public void calculateSize(JList list, int index, JPanel contentPane) { } public JPanel createCenterPanel(JList list, Object value, int index, boolean isSelected, boolean isEnabled, JScrollPane parentScrollPane, int leftColumnWidth) { DefaultListCellRenderer label = (DefaultListCellRenderer) mRenderer .getListCellRendererComponent(list, value, index, isSelected, false); String filterName = value.toString(); String iconFileName = mIcons.get(filterName); Icon icon = null; if (!StringUtils.isEmpty(iconFileName)) { try { icon = FilterViewPlugin.getInstance().getIcon( FilterViewSettings.getIconDirectoryName() + File.separatorChar + iconFileName); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } label.setIcon(icon); } String text = filterName; if (icon == null) { text += " (" + mLocalizer.msg("noIcon", "no icon") + ')'; } label.setText(text); label.setHorizontalAlignment(SwingConstants.LEADING); label.setVerticalAlignment(SwingConstants.CENTER); label.setOpaque(false); JPanel panel = new JPanel(new BorderLayout()); if (isSelected && isEnabled) { panel.setOpaque(true); panel.setForeground(list.getSelectionForeground()); panel.setBackground(list.getSelectionBackground()); } else { panel.setOpaque(false); panel.setForeground(list.getForeground()); panel.setBackground(list.getBackground()); } panel.add(label, BorderLayout.WEST); return panel; } }); panelBuilder.addGrowingRow(); panelBuilder.add(mFilterList, cc.xyw(2, panelBuilder.getRow(), panelBuilder.getColumnCount() - 1)); panelBuilder.addRow(); mFilterButton = new JButton(mLocalizer.msg("changeIcon", "Change icon")); mFilterButton.setEnabled(false); panelBuilder.add(mFilterButton, cc.xyw(2, panelBuilder.getRow(), 1)); mRemoveButton = new JButton(mLocalizer.msg("deleteIcon", "Remove icon")); mRemoveButton.setEnabled(false); panelBuilder.add(mRemoveButton, cc.xyw(4, panelBuilder.getRow(), 1)); mFilterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SelectableItem item = (SelectableItem) mFilterList.getSelectedValue(); String filterName = (String) item.getItem(); chooseIcon(filterName); } }); mFilterList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { mFilterButton.setEnabled(mFilterList.getSelectedValue() != null); mRemoveButton.setEnabled(mFilterButton.isEnabled()); } }); mRemoveButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { SelectableItem item = (SelectableItem) mFilterList.getSelectedValue(); String filterName = (String) item.getItem(); mIcons.put(filterName, ""); mFilterList.updateUI(); } }); return panelBuilder.getPanel(); }
From source file:com.projity.pm.graphic.frames.GraphicManager.java
public void setRibbon(JRibbonFrame frame, MenuManager menuManger) { final JPanel filtersPanel = new JPanel(new GridLayout(3, 1)); filterToolBarManager = FilterToolBarManager.create(getMenuManager()); filterToolBarManager.addButtonsInRibbonBand(filtersPanel); CustomRibbonBandGenerator customBandsGenerator = new CustomRibbonBandGenerator() { @Override/*from ww w . j a va 2 s .c om*/ public JComponent createRibbonComponent(String ribbonBandName) { if ("FiltersRibbonBand".equals(ribbonBandName)) { return filtersPanel; } else return null; } }; Collection<RibbonTask> ribbonTasks = menuManger.getRibbon(MenuManager.STANDARD_RIBBON, customBandsGenerator); JRibbon ribbon = frame.getRibbon(); for (RibbonTask ribbonTask : ribbonTasks) { ribbon.addTask(ribbonTask); } RibbonApplicationMenu applicationMenu = new RibbonApplicationMenu(); ribbon.setApplicationMenu(applicationMenu); Collection<AbstractCommandButton> taskBars = menuManger.getTaskBar(MenuManager.STANDARD_RIBBON); for (AbstractCommandButton button : taskBars) ribbon.addTaskbarComponent(button); ribbon.configureHelp(IconManager.getRibbonIcon("ribbon.help", 26, 26), new ActionListener() { @Override public void actionPerformed(ActionEvent e) { showHelpDialog(); } }); JLabel openprojLogo = ribbon.getOpenprojLogo(); openprojLogo.setIcon(IconManager.getIcon("logo.OpenProj")); openprojLogo.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent me) { BrowserControl.displayURL("http://www.projity.com/"); } }); JPanel projectViews = ribbon.getProjectViews(); projectViews.setBorder(new EmptyBorder(0, 0, 0, 0)); getMenuManager().initComponent(MenuManager.RIBBON_VIEW_BAR, projectViews); JPanel fileSelector = ribbon.getFileSelector(); fileSelector.setLayout(new BorderLayout()); fileSelector.setBackground(ProjectLibreRibbonUI.RIBBON_MENU_COLOR); JComponent filesComponent = ((DefaultFrameManager) getFrameManager()).getProjectComboPanel(); filesComponent.setBackground(ProjectLibreRibbonUI.RIBBON_MENU_COLOR); fileSelector.add(filesComponent, BorderLayout.EAST); projectViews.setBorder(new EmptyBorder(0, 0, 0, 0)); }
From source file:edu.ku.brc.specify.Specify.java
/** * General Method for initializing the class * *///from ww w .java2 s . co m private void initialize(final GraphicsConfiguration gc) { setLayout(new BorderLayout()); // set the preferred size of the demo setPreferredSize(new Dimension(PREFERRED_WIDTH, PREFERRED_HEIGHT)); setPreferredSize(new Dimension(1024, 768)); // For demo topFrame = new JFrame(gc); topFrame.setIconImage(IconManager.getImage(getIconName()).getImage()); //$NON-NLS-1$ //topFrame.setAlwaysOnTop(true); topFrame.setGlassPane(glassPane = GhostGlassPane.getInstance()); topFrame.setLocationRelativeTo(null); Toolkit.getDefaultToolkit().setDynamicLayout(true); UIRegistry.register(UIRegistry.GLASSPANE, glassPane); // Don't check everytime, too annoying //AppPreferences.getLocalPrefs().remove("SYSTEM.HasOpenGL"); // clear prop so it is checked UIHelper.checkForOpenGL(); JPanel top = new JPanel(); top.setLayout(new BorderLayout()); add(top, BorderLayout.NORTH); UIRegistry.setTopWindow(topFrame); menuBar = createMenus(); if (menuBar != null) { topFrame.setJMenuBar(menuBar); } UIRegistry.register(UIRegistry.MENUBAR, menuBar); JToolBar toolBar = createToolBar(); if (toolBar != null) { top.add(toolBar, BorderLayout.CENTER); } UIRegistry.register(UIRegistry.TOOLBAR, toolBar); mainPanel = new MainPanel(); int[] sections = { 5, 5, 5, 1 }; statusField = new JStatusBar(sections); statusField.setErrorIcon(IconManager.getIcon("Error", IconManager.IconSize.Std16)); //$NON-NLS-1$ statusField.setWarningIcon(IconManager.getIcon("Warning", IconManager.IconSize.Std16)); //$NON-NLS-1$ UIRegistry.setStatusBar(statusField); JLabel secLbl = statusField.getSectionLabel(3); if (secLbl != null) { boolean isSecurityOn = AppContextMgr.isSecurityOn(); secLbl.setIcon( IconManager.getImage(isSecurityOn ? "SecurityOn" : "SecurityOff", IconManager.IconSize.Std16)); secLbl.setHorizontalAlignment(SwingConstants.CENTER); secLbl.setHorizontalTextPosition(SwingConstants.LEFT); secLbl.setText(""); secLbl.setToolTipText(getResourceString("Specify.SEC_" + (isSecurityOn ? "ON" : "OFF"))); } add(statusField, BorderLayout.SOUTH); }
From source file:semaforo.Semaforo.java
public void calculoColorPorcentajeGroups(JLabel label, double porcentajeD) { int porcentaje = 0; if (porcentajeD != 0) porcentaje = (int) ((int) 100 - porcentajeD); if (porcentaje < 0) { label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/semaforo/resources/verde-c.png"))); porcentaje = 0;/*from w w w. ja v a2 s . co m*/ } label.setText(porcentaje + "%"); if (porcentaje >= 0 && porcentaje <= 50) { label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/semaforo/resources/verde-c.png"))); } if (porcentaje >= 51 && porcentaje <= 75) { label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/semaforo/resources/amarillo-c.png"))); } if (porcentaje >= 76) { label.setIcon(new javax.swing.ImageIcon(getClass().getResource("/semaforo/resources/rojo-c.png"))); } }
From source file:eu.crisis_economics.abm.dashboard.Page_Parameters.java
private void appendImageToPresentation(DefaultFormBuilder formBuilder, final String imageFilename) { if (imageFilename == null || imageFilename.isEmpty()) return;/*from w w w .j av a2 s. c o m*/ ImageIcon icon = null; try { final ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); final InputStream imageStream = classLoader.getResourceAsStream(imageFilename); final Image image = ImageIO.read(imageStream); icon = new ImageIcon(image); } catch (final IOException e) { icon = new ImageIcon(imageFilename); } final JLabel component = new JLabel("<html><div style=\"margin: 8pt\"></div></html>"); component.setIcon(icon); formBuilder.append(component, 3); }
From source file:edu.ku.brc.specify.Specify.java
/** * Create menus//from w ww.j av a 2 s . c o m */ public JMenuBar createMenus() { JMenuBar mb = new JMenuBar(); JMenuItem mi; //-------------------------------------------------------------------- //-- File Menu //-------------------------------------------------------------------- JMenu menu = null; if (!UIHelper.isMacOS() || !isWorkbenchOnly) { menu = UIHelper.createLocalizedMenu(mb, "Specify.FILE_MENU", "Specify.FILE_MNEU"); //$NON-NLS-1$ //$NON-NLS-2$ } if (!isWorkbenchOnly) { // Add Menu for switching Collection String title = "Specify.CHANGE_COLLECTION"; //$NON-NLS-1$ String mnu = "Specify.CHANGE_COLL_MNEU"; //$NON-NLS-1$ changeCollectionMenuItem = UIHelper.createLocalizedMenuItem(menu, title, mnu, title, false, null); changeCollectionMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { if (SubPaneMgr.getInstance().aboutToShutdown()) { // Actually we really need to start over // "true" means that it should NOT use any cached values it can find to automatically initialize itself // instead it should ask the user any questions as if it were starting over restartApp(null, databaseName, userName, true, false); } } }); menu.addMenuListener(new MenuListener() { @Override public void menuCanceled(MenuEvent e) { } @Override public void menuDeselected(MenuEvent e) { } @Override public void menuSelected(MenuEvent e) { boolean enable = Uploader.getCurrentUpload() == null && ((SpecifyAppContextMgr) AppContextMgr.getInstance()).getNumOfCollectionsForUser() > 1 && !TaskMgr.areTasksDisabled(); changeCollectionMenuItem.setEnabled(enable); } }); } if (UIHelper.getOSType() != UIHelper.OSTYPE.MacOSX) { if (!UIRegistry.isMobile()) { menu.addSeparator(); } String title = "Specify.EXIT"; //$NON-NLS-1$ String mnu = "Specify.Exit_MNEU"; //$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(menu, title, mnu, title, true, null); if (!UIHelper.isMacOS()) { mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_Q, InputEvent.CTRL_DOWN_MASK)); } mi.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { doExit(true); } }); } menu = UIRegistry.getInstance().createEditMenu(); mb.add(menu); //menu = UIHelper.createMenu(mb, "EditMenu", "EditMneu"); if (UIHelper.getOSType() != UIHelper.OSTYPE.MacOSX) { menu.addSeparator(); String title = "Specify.PREFERENCES"; //$NON-NLS-1$ String mnu = "Specify.PREFERENCES_MNEU";//$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(menu, title, mnu, title, false, null); mi.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { doPreferences(); } }); mi.setEnabled(true); } //-------------------------------------------------------------------- //-- Data Menu //-------------------------------------------------------------------- JMenu dataMenu = UIHelper.createLocalizedMenu(mb, "Specify.DATA_MENU", "Specify.DATA_MNEU"); //$NON-NLS-1$ //$NON-NLS-2$ ResultSetController.addMenuItems(dataMenu); dataMenu.addSeparator(); // Save And New Menu Item Action saveAndNewAction = new AbstractAction(getResourceString("Specify.SAVE_AND_NEW")) { //$NON-NLS-1$ public void actionPerformed(ActionEvent e) { FormViewObj fvo = getCurrentFVO(); if (fvo != null) { fvo.setSaveAndNew(((JCheckBoxMenuItem) e.getSource()).isSelected()); } } }; saveAndNewAction.setEnabled(false); JCheckBoxMenuItem saveAndNewCBMI = new JCheckBoxMenuItem(saveAndNewAction); dataMenu.add(saveAndNewCBMI); UIRegistry.register("SaveAndNew", saveAndNewCBMI); //$NON-NLS-1$ UIRegistry.registerAction("SaveAndNew", saveAndNewAction); //$NON-NLS-1$ mb.add(dataMenu); // Configure Carry Forward Action configCarryForwardAction = new AbstractAction( getResourceString("Specify.CONFIG_CARRY_FORWARD_MENU")) { //$NON-NLS-1$ public void actionPerformed(ActionEvent e) { FormViewObj fvo = getCurrentFVO(); if (fvo != null) { fvo.configureCarryForward(); } } }; configCarryForwardAction.setEnabled(false); JMenuItem configCFWMI = new JMenuItem(configCarryForwardAction); dataMenu.add(configCFWMI); UIRegistry.register("ConfigCarryForward", configCFWMI); //$NON-NLS-1$ UIRegistry.registerAction("ConfigCarryForward", configCarryForwardAction); //$NON-NLS-1$ mb.add(dataMenu); //--------------------------------------- // Carry Forward Menu Item (On / Off) Action carryForwardAction = new AbstractAction(getResourceString("Specify.CARRY_FORWARD_CHECKED_MENU")) { //$NON-NLS-1$ public void actionPerformed(ActionEvent e) { FormViewObj fvo = getCurrentFVO(); if (fvo != null) { fvo.toggleCarryForward(); ((JCheckBoxMenuItem) e.getSource()).setSelected(fvo.isDoCarryForward()); } } }; carryForwardAction.setEnabled(false); JCheckBoxMenuItem carryForwardCBMI = new JCheckBoxMenuItem(carryForwardAction); dataMenu.add(carryForwardCBMI); UIRegistry.register("CarryForward", carryForwardCBMI); //$NON-NLS-1$ UIRegistry.registerAction("CarryForward", carryForwardAction); //$NON-NLS-1$ mb.add(dataMenu); if (!isWorkbenchOnly) { final String AUTO_NUM = "AutoNumbering"; //--------------------------------------- // AutoNumber Menu Item (On / Off) Action autoNumberOnOffAction = new AbstractAction( getResourceString("FormViewObj.SET_AUTONUMBER_ONOFF")) { //$NON-NLS-1$ public void actionPerformed(ActionEvent e) { FormViewObj fvo = getCurrentFVO(); if (fvo != null) { fvo.toggleAutoNumberOnOffState(); ((JCheckBoxMenuItem) e.getSource()).setSelected(fvo.isAutoNumberOn()); } } }; autoNumberOnOffAction.setEnabled(false); JCheckBoxMenuItem autoNumCBMI = new JCheckBoxMenuItem(autoNumberOnOffAction); dataMenu.add(autoNumCBMI); UIRegistry.register(AUTO_NUM, autoNumCBMI); //$NON-NLS-1$ UIRegistry.registerAction(AUTO_NUM, autoNumberOnOffAction); //$NON-NLS-1$ } if (System.getProperty("user.name").equals("rods")) { dataMenu.addSeparator(); AbstractAction gpxAction = new AbstractAction("GPS Data") { @Override public void actionPerformed(ActionEvent e) { GPXPanel.getDlgInstance().setVisible(true); } }; JMenuItem gpxMI = new JMenuItem(gpxAction); dataMenu.add(gpxMI); UIRegistry.register("GPXDlg", gpxMI); //$NON-NLS-1$ UIRegistry.registerAction("GPXDlg", gpxAction); //$NON-NLS-1$ } mb.add(dataMenu); SubPaneMgr.getInstance(); // force creating of the Mgr so the menu Actions are created. //-------------------------------------------------------------------- //-- System Menu //-------------------------------------------------------------------- if (!isWorkbenchOnly) { // TODO This needs to be moved into the SystemTask, but right now there is no way // to ask a task for a menu. menu = UIHelper.createLocalizedMenu(mb, "Specify.SYSTEM_MENU", "Specify.SYSTEM_MNEU"); //$NON-NLS-1$ //$NON-NLS-2$ /*if (true) { menu = UIHelper.createMenu(mb, "Forms", "o"); Action genForms = new AbstractAction() { public void actionPerformed(ActionEvent ae) { FormGenerator fg = new FormGenerator(); fg.generateForms(); } }; mi = UIHelper.createMenuItemWithAction(menu, "Generate All Forms", "G", "", true, genForms); }*/ } //-------------------------------------------------------------------- //-- Tab Menu //-------------------------------------------------------------------- menu = UIHelper.createLocalizedMenu(mb, "Specify.TABS_MENU", "Specify.TABS_MNEU"); //$NON-NLS-1$ //$NON-NLS-2$ String ttl = UIRegistry.getResourceString("Specify.SBP_CLOSE_CUR_MENU"); String mnu = UIRegistry.getResourceString("Specify.SBP_CLOSE_CUR_MNEU"); mi = UIHelper.createMenuItemWithAction(menu, ttl, mnu, ttl, true, getAction("CloseCurrent")); if (!UIHelper.isMacOS()) { mi.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK)); } ttl = UIRegistry.getResourceString("Specify.SBP_CLOSE_ALL_MENU"); mnu = UIRegistry.getResourceString("Specify.SBP_CLOSE_ALL_MNEU"); mi = UIHelper.createMenuItemWithAction(menu, ttl, mnu, ttl, true, getAction("CloseAll")); if (!UIHelper.isMacOS()) { mi.setAccelerator( KeyStroke.getKeyStroke(KeyEvent.VK_W, InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)); } ttl = UIRegistry.getResourceString("Specify.SBP_CLOSE_ALLBUT_MENU"); mnu = UIRegistry.getResourceString("Specify.SBP_CLOSE_ALLBUT_MNEU"); mi = UIHelper.createMenuItemWithAction(menu, ttl, mnu, ttl, true, getAction("CloseAllBut")); menu.addSeparator(); // Configure Task JMenuItem configTaskMI = new JMenuItem(getAction("ConfigureTask")); menu.add(configTaskMI); //UIRegistry.register("ConfigureTask", configTaskMI); //$NON-NLS-1$ //-------------------------------------------------------------------- //-- Debug Menu //-------------------------------------------------------------------- boolean doDebug = AppPreferences.getLocalPrefs().getBoolean("debug.menu", false); if (!UIRegistry.isRelease() || doDebug) { menu = UIHelper.createLocalizedMenu(mb, "Specify.DEBUG_MENU", "Specify.DEBUG_MNEU"); //$NON-NLS-1$ //$NON-NLS-2$ String ttle = "Specify.SHOW_LOC_PREFS";//$NON-NLS-1$ String mneu = "Specify.SHOW_LOC_PREF_MNEU";//$NON-NLS-1$ String desc = "Specify.SHOW_LOC_PREFS";//$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(menu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { @SuppressWarnings("synthetic-access") //$NON-NLS-1$ public void actionPerformed(ActionEvent ae) { openLocalPrefs(); } }); ttle = "Specify.SHOW_REM_PREFS";//$NON-NLS-1$ mneu = "Specify.SHOW_REM_PREFS_MNEU";//$NON-NLS-1$ desc = "Specify.SHOW_REM_PREFS";//$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(menu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { @SuppressWarnings("synthetic-access") //$NON-NLS-1$ public void actionPerformed(ActionEvent ae) { openRemotePrefs(); } }); menu.addSeparator(); ttle = "Specify.CONFIG_LOGGERS";//$NON-NLS-1$ mneu = "Specify.CONFIG_LOGGERS_MNEU";//$NON-NLS-1$ desc = "Specify.CONFIG_LOGGER";//$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(menu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { @SuppressWarnings("synthetic-access") //$NON-NLS-1$ public void actionPerformed(ActionEvent ae) { final LoggerDialog dialog = new LoggerDialog(topFrame); UIHelper.centerAndShow(dialog); } }); ttle = "Specify.CONFIG_DEBUG_LOGGERS";//$NON-NLS-1$ mneu = "Specify.CONFIG_DEBUG_LOGGERS_MNEU";//$NON-NLS-1$ desc = "Specify.CONFIG_DEBUG_LOGGER";//$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(menu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { @SuppressWarnings("synthetic-access") //$NON-NLS-1$ public void actionPerformed(ActionEvent ae) { DebugLoggerDialog dialog = new DebugLoggerDialog(topFrame); UIHelper.centerAndShow(dialog); } }); menu.addSeparator(); ttle = "Specify.SHOW_MEM_STATS";//$NON-NLS-1$ mneu = "Specify.SHOW_MEM_STATS_MNEU";//$NON-NLS-1$ desc = "Specify.SHOW_MEM_STATS";//$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(menu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { @SuppressWarnings("synthetic-access") //$NON-NLS-1$ public void actionPerformed(ActionEvent ae) { System.gc(); System.runFinalization(); // Get current size of heap in bytes double meg = 1024.0 * 1024.0; double heapSize = Runtime.getRuntime().totalMemory() / meg; // Get maximum size of heap in bytes. The heap cannot grow beyond this size. // Any attempt will result in an OutOfMemoryException. double heapMaxSize = Runtime.getRuntime().maxMemory() / meg; // Get amount of free memory within the heap in bytes. This size will increase // after garbage collection and decrease as new objects are created. double heapFreeSize = Runtime.getRuntime().freeMemory() / meg; UIRegistry.getStatusBar() .setText(String.format("Heap Size: %7.2f Max: %7.2f Free: %7.2f Used: %7.2f", //$NON-NLS-1$ heapSize, heapMaxSize, heapFreeSize, (heapSize - heapFreeSize))); } }); JMenu prefsMenu = new JMenu(UIRegistry.getResourceString("Specify.PREFS_IMPORT_EXPORT")); //$NON-NLS-1$ menu.add(prefsMenu); ttle = "Specify.IMPORT_MENU";//$NON-NLS-1$ mneu = "Specify.IMPORT_MNEU";//$NON-NLS-1$ desc = "Specify.IMPORT_PREFS";//$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(prefsMenu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { @SuppressWarnings("synthetic-access") //$NON-NLS-1$ public void actionPerformed(ActionEvent ae) { importPrefs(); } }); ttle = "Specify.EXPORT_MENU";//$NON-NLS-1$ mneu = "Specify.EXPORT_MNEU";//$NON-NLS-1$ desc = "Specify.EXPORT_PREFS";//$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(prefsMenu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { @SuppressWarnings("synthetic-access") //$NON-NLS-1$ public void actionPerformed(ActionEvent ae) { exportPrefs(); } }); ttle = "Associate Storage Items";//$NON-NLS-1$ mneu = "A";//$NON-NLS-1$ desc = "";//$NON-NLS-1$ mi = UIHelper.createMenuItemWithAction(menu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { @SuppressWarnings("synthetic-access") //$NON-NLS-1$ public void actionPerformed(ActionEvent ae) { associateStorageItems(); } }); ttle = "Load GPX Points";//$NON-NLS-1$ mneu = "a";//$NON-NLS-1$ desc = "";//$NON-NLS-1$ mi = UIHelper.createMenuItemWithAction(menu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { @SuppressWarnings("synthetic-access") //$NON-NLS-1$ public void actionPerformed(ActionEvent ae) { CustomDialog dlg = GPXPanel.getDlgInstance(); if (dlg != null) { dlg.setVisible(true); } } }); JCheckBoxMenuItem cbMenuItem = new JCheckBoxMenuItem("Security Activated"); //$NON-NLS-1$ menu.add(cbMenuItem); cbMenuItem.setSelected(AppContextMgr.isSecurityOn()); cbMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { boolean isSecurityOn = !SpecifyAppContextMgr.isSecurityOn(); AppContextMgr.getInstance().setSecurity(isSecurityOn); ((JMenuItem) ae.getSource()).setSelected(isSecurityOn); JLabel secLbl = statusField.getSectionLabel(3); if (secLbl != null) { secLbl.setIcon(IconManager.getImage(isSecurityOn ? "SecurityOn" : "SecurityOff", IconManager.IconSize.Std16)); secLbl.setHorizontalAlignment(SwingConstants.CENTER); secLbl.setToolTipText(getResourceString("Specify.SEC_" + (isSecurityOn ? "ON" : "OFF"))); } } }); JMenuItem sizeMenuItem = new JMenuItem("Set to " + PREFERRED_WIDTH + "x" + PREFERRED_HEIGHT); //$NON-NLS-1$ menu.add(sizeMenuItem); sizeMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { topFrame.setSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); } }); } //---------------------------------------------------- //-- Helper Menu //---------------------------------------------------- JMenu helpMenu = UIHelper.createLocalizedMenu(mb, "Specify.HELP_MENU", "Specify.HELP_MNEU"); //$NON-NLS-1$ //$NON-NLS-2$ HelpMgr.createHelpMenuItem(helpMenu, getResourceString("SPECIFY_HELP")); //$NON-NLS-1$ helpMenu.addSeparator(); String ttle = "Specify.LOG_SHOW_FILES";//$NON-NLS-1$ String mneu = "Specify.LOG_SHOW_FILES_MNEU";//$NON-NLS-1$ String desc = "Specify.LOG_SHOW_FILES";//$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(helpMenu, ttle, mneu, desc, true, null); helpMenu.addSeparator(); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { AppBase.displaySpecifyLogFiles(); } }); ttle = "SecurityAdminTask.CHANGE_PWD_MENU"; //$NON-NLS-1$ mneu = "SecurityAdminTask.CHANGE_PWD_MNEU"; //$NON-NLS-1$ desc = "SecurityAdminTask.CHANGE_PWD_DESC"; //$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(helpMenu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { SecurityAdminTask.changePassword(true); } }); ttle = "Specify.CHECK_UPDATE";//$NON-NLS-1$ mneu = "Specify.CHECK_UPDATE_MNEU";//$NON-NLS-1$ desc = "Specify.CHECK_UPDATE_DESC";//$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(helpMenu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { checkForUpdates(); } }); ttle = "Specify.AUTO_REG";//$NON-NLS-1$ mneu = "Specify.AUTO_REG_MNEU";//$NON-NLS-1$ desc = "Specify.AUTO_REG_DESC";//$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(helpMenu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { RegisterSpecify.register(true, 0); } }); ttle = "Specify.SA_REG";//$NON-NLS-1$ mneu = "Specify.SA_REG_MNEU";//$NON-NLS-1$ desc = "Specify.SA_REG_DESC";//$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(helpMenu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { RegisterSpecify.registerISA(); } }); ttle = "Specify.FEEDBACK";//$NON-NLS-1$ mneu = "Specify.FB_MNEU";//$NON-NLS-1$ desc = "Specify.FB_DESC";//$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(helpMenu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { FeedBackDlg feedBackDlg = new FeedBackDlg(); feedBackDlg.sendFeedback(); } }); if (UIHelper.getOSType() != UIHelper.OSTYPE.MacOSX) { helpMenu.addSeparator(); ttle = "Specify.ABOUT";//$NON-NLS-1$ mneu = "Specify.ABOUTMNEU";//$NON-NLS-1$ desc = "Specify.ABOUT";//$NON-NLS-1$ mi = UIHelper.createLocalizedMenuItem(helpMenu, ttle, mneu, desc, true, null); mi.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { doAbout(); } }); } return mb; }
From source file:course_generator.frmMain.java
/** * Add a tab to JTabbedPane. The icon is at the left of the text and there * some space between the icon and the label * /*from w w w . ja va 2 s. c om*/ * @param tabbedPane * JTabbedPane where we want to add the tab * @param tab * Tab to add * @param title * Title of the tab * @param icon * Icon of the tab */ private void addTab(JTabbedPane tabbedPane, Component tab, String title, Icon icon) { tabbedPane.add(tab); // Create bespoke component for rendering the tab. javax.swing.JLabel lbl = new javax.swing.JLabel(title); lbl.setIcon(icon); // Add some spacing between text and icon, and position text to the RHS. lbl.setIconTextGap(5); lbl.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); tabbedPane.setTabComponentAt(tabbedPane.getTabCount() - 1, lbl); }
From source file:Form.Principal.java
public void PanelUsuarios() { int i = 0;//from w w w . ja v a 2s . c o m int Altura = 0; Color gris = new Color(44, 44, 44); Color azul = new Color(0, 153, 255); Color rojo = new Color(221, 76, 76); try { //Consultamos todos los clientes ResultSet Comandos = Funcion.Select(st, "SELECT * FROM usuarios where Tipo!='Administrador';"); //Ciclo para crear un panel para cada uno while (Comandos.next()) { //Creamos un panel con alineacion a la izquierda JPanel Panel = new JPanel(); Panel.setLayout(null); jPanel12.add(Panel); //Tamao del panel Panel.setSize(500, 200); // La posicion y del panel ira incrementando para que no se encimen Altura = 40 + (i * 220); Panel.setLocation(175, Altura); Panel.setBackground(Color.white); Panel.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED)); //Creamos label para mostrar los datos del cliente, el codigo html es para que al llegar al final del panel //se pase a la siguiente linea y para el margen izquierdo JLabel Foto = new JLabel(); Foto.setSize(150, 150); File FotoPerfil = new File("Imagenes/Fotos Perfil/" + Comandos.getInt("id") + ".png"); File FotoPerfil2 = new File("Imagenes/Fotos Perfil/" + Comandos.getInt("id") + ".jpg"); if (FotoPerfil.exists()) { ImageIcon Imagen = new ImageIcon("Imagenes/Fotos Perfil/" + Comandos.getInt("id") + ".png"); Image ImagenEscalada = Imagen.getImage().getScaledInstance(Foto.getWidth(), Foto.getHeight(), Image.SCALE_SMOOTH); Icon IconoEscalado = new ImageIcon(ImagenEscalada); Foto.setIcon(IconoEscalado); } else if (FotoPerfil2.exists()) { ImageIcon Imagen = new ImageIcon("Imagenes/Fotos Perfil/" + Comandos.getInt("id") + ".jpg"); Image ImagenEscalada = Imagen.getImage().getScaledInstance(Foto.getWidth(), Foto.getHeight(), Image.SCALE_SMOOTH); Icon IconoEscalado = new ImageIcon(ImagenEscalada); Foto.setIcon(IconoEscalado); } else { ImageIcon Imagen = new ImageIcon(getClass().getResource("/Imagen/Default.png")); Image ImagenEscalada = Imagen.getImage().getScaledInstance(Foto.getWidth(), Foto.getHeight(), Image.SCALE_SMOOTH); Icon IconoEscalado = new ImageIcon(ImagenEscalada); Foto.setIcon(IconoEscalado); } JLabel Nombre = new JLabel(); Nombre.setText("Nombre de Usuario: " + Comandos.getString("Nombre")); JLabel Contrasena = new JLabel(); Contrasena.setText(("Contrasea: " + Comandos.getString("contrasena"))); JButton Editar = new JButton(); Editar.setText("Editar"); Editar.setName(Comandos.getString("id")); Editar.setBackground(azul); JButton Eliminar = new JButton(); Eliminar.setText("Eliminar"); Eliminar.setName(Comandos.getString("id")); Eliminar.setBackground(rojo); MouseListener mlEditar = new MouseListener() { @Override public void mouseReleased(MouseEvent e) { //System.out.println("Released!"); } @Override public void mousePressed(MouseEvent e) { //System.out.println("Pressed!"); } @Override public void mouseExited(MouseEvent e) { //System.out.println("Exited!"); } @Override public void mouseEntered(MouseEvent e) { //System.out.println("Entered!"); } @Override public void mouseClicked(MouseEvent e) { presionadoactual = 24; Color azul = new Color(0, 182, 230); jButton24.setBackground(azul); JButton source = (JButton) e.getSource(); System.out.println(source.getName()); jPanel17.setVisible(false); jButton30.setLocation(470, 480); jButton31.setLocation(270, 480); jLabel2.setToolTipText(null); jTabbedPane2.setSelectedIndex(5); editando = true; PerfilUsuario(Integer.parseInt(source.getName())); Color gris = new Color(44, 44, 44); jButton4.setBackground(gris); } }; MouseListener mlEliminar = new MouseListener() { @Override public void mouseReleased(MouseEvent e) { //System.out.println("Released!"); } @Override public void mousePressed(MouseEvent e) { //System.out.println("Pressed!"); } @Override public void mouseExited(MouseEvent e) { //System.out.println("Exited!"); } @Override public void mouseEntered(MouseEvent e) { //System.out.println("Entered!"); } @Override public void mouseClicked(MouseEvent e) { JButton source = (JButton) e.getSource(); System.out.println(source.getName()); Funcion.Update(st, "DELETE FROM usuarios WHERE id = " + source.getName() + ";"); jPanel12.removeAll(); PanelUsuarios(); jPanel12.repaint(); } }; Editar.addMouseListener(mlEditar); Eliminar.addMouseListener(mlEliminar); //Fuente del texto; Nombre.setFont(new Font("Verdana", Font.PLAIN, 15)); Nombre.setForeground(gris); Contrasena.setFont(new Font("Verdana", Font.PLAIN, 15)); Contrasena.setForeground(gris); Editar.setFont(new Font("Verdana", Font.PLAIN, 15)); Editar.setForeground(Color.white); Eliminar.setFont(new Font("Verdana", Font.PLAIN, 15)); Eliminar.setForeground(Color.white); //Aadimos los label al panel correspondiente del cliente Panel.add(Foto); Panel.add(Nombre); Panel.add(Contrasena); Panel.add(Editar); Panel.add(Eliminar); Foto.setLocation(10, 20); Nombre.setLocation(170, 30); Nombre.setSize(300, 45); Contrasena.setLocation(170, 60); Contrasena.setSize(300, 45); Editar.setLocation(170, 100); Editar.setSize(120, 40); Eliminar.setLocation(315, 100); Eliminar.setSize(120, 40); i++; } } catch (SQLException ex) { Logger.getLogger(Principal.class.getName()).log(Level.SEVERE, null, ex); } //Dependiendo de cuantos clientes se agregaron, se ajusta el tamao del panel principal para que el scroll llegue hasta ahi jPanel12.setPreferredSize(new Dimension(jPanel12.getWidth(), Altura + 150)); }
From source file:in.gov.uidai.auth.sampleapp.SampleClientMainFrame.java
private void displayAuthResults(AuthRes authResult, boolean useProto) { javax.swing.JLabel status = (useProto ? this.jLabelAuthStatusTextProto : this.jLabelAuthStatusTextXML); javax.swing.JLabel statusLabel = (useProto ? this.jLabelAuthStatusProto : this.jLabelAuthStatus); statusLabel.setText(useProto ? "Proto " : "XML"); if (authResult.getRet().equals(AuthResult.Y)) { statusLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/success.png"))); status.setVisible(false);// ww w. ja va2 s.c om status.setText(""); } else { statusLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/failure.png"))); status.setText((useProto ? "Proto " : "XML") + " Error code: " + authResult.getErr() + " (" + ErrorCodeDescriptions.getDescription(authResult.getErr()) + ")"); status.setVisible(true); } String origValue = StringUtils.isNotBlank(this.jLabelAuthRefCodeValue.getText()) ? this.jLabelAuthRefCodeValue.getText() + ", " : ""; this.jLabelAuthRefCodeValue.setText(origValue + authResult.getCode()); this.jLabelAuthRefCodeValue.setVisible(true); this.jLabelAuthRefCode.setVisible(true); }