List of usage examples for javax.swing JButton setBounds
public void setBounds(int x, int y, int width, int height)
From source file:es.emergya.ui.base.plugins.PluggableJTabbedPane.java
private void addFloatingButtons() { JButton salir = new JButton(); salir.addActionListener(new ExitHandler()); Icon icon = LogicConstants.getIcon("header_button_exit"); salir.setIcon(icon);//from w ww . j a va 2 s.c o m if (icon != null) if (min_height < icon.getIconHeight()) min_height = icon.getIconHeight(); // Aadimos el botn de Salir salir.setBounds(this.getWidth() - icon.getIconWidth() - 2, 2, icon.getIconWidth(), icon.getIconHeight()); salir.setBorderPainted(false); PluggableJTabbedPane.this.salir = salir.getBounds(); // Logo de la empresa JLabel logo = new JLabel(); icon = LogicConstants.getIcon("header_logo_cliente"); if (min_height < icon.getIconHeight()) min_height = icon.getIconHeight(); logo.setIcon(icon); logo.setBounds(salir.getBounds().x - icon.getIconWidth() - 2, 2, icon.getIconWidth(), icon.getIconHeight()); JLabel companyLogo = new JLabel(); icon = LogicConstants.getIcon("header_logo"); if (icon != null) if (min_height < icon.getIconHeight()) min_height = icon.getIconHeight(); companyLogo.setIcon(icon); companyLogo.setBounds(logo.getBounds().x - icon.getIconWidth(), 2, icon.getIconWidth(), icon.getIconHeight()); botones_flotantes = new ArrayList<JComponent>(); addFloatingButton(companyLogo); addFloatingButton(logo); addFloatingButton(salir); repaint(); }
From source file:dpcs.About.java
public About() { setIconImage(Toolkit.getDefaultToolkit().getImage(About.class.getResource("/graphics/Icon.png"))); setResizable(false);/*www. ja v a 2 s. c o m*/ setType(Type.UTILITY); setTitle("About"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 540, 400); contentPane = new JPanel(); contentPane.setBackground(Color.WHITE); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); try { InputStreamReader reader2 = new InputStreamReader( getClass().getResourceAsStream("/others/app-version.txt")); String tmp = IOUtils.toString(reader2); AppVersion = Double.parseDouble(tmp); } catch (IOException e1) { e1.printStackTrace(); } JButton btnGitHub = new JButton("GitHub"); btnGitHub.setToolTipText("Access Droid PC Suite github repository"); btnGitHub.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { Desktop.getDesktop().browse(new URL("https://github.com/kvsjxd/Droid-PC-Suite/").toURI()); } catch (Exception e) { e.printStackTrace(); } } }); btnGitHub.setBounds(369, 295, 111, 25); contentPane.add(btnGitHub); JLabel lblMyFriend4 = new JLabel("Gulati-kun"); lblMyFriend4.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend4.setBounds(25, 266, 242, 24); contentPane.add(lblMyFriend4); JLabel lblMyFriend3 = new JLabel("Anil-kun"); lblMyFriend3.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend3.setBounds(25, 242, 242, 24); contentPane.add(lblMyFriend3); JLabel lblMyFriend2 = new JLabel("Suri-kun"); lblMyFriend2.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend2.setBounds(25, 217, 242, 24); contentPane.add(lblMyFriend2); JLabel lblApplicationVersion = new JLabel("Version: " + AppVersion); lblApplicationVersion.setFont(new Font("Dialog", Font.BOLD, 14)); lblApplicationVersion.setBounds(382, 16, 132, 18); contentPane.add(lblApplicationVersion); JLabel lblForMyOther = new JLabel("For my other Android stuff visit me on XDA - Developers (@kvsjxd)"); lblForMyOther.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { try { Desktop.getDesktop().browse(new URL( "http://forum.xda-developers.com/member.php?s=82fb1dacfee601c8f79084b30d57d5a2&u=5640594") .toURI()); } catch (Exception e) { e.printStackTrace(); } } @Override public void mouseEntered(MouseEvent e) { lblForMyOther.setForeground(Color.BLUE); } @Override public void mouseExited(MouseEvent e) { lblForMyOther.setForeground(Color.BLACK); } }); lblForMyOther.setFont(new Font("Dialog", Font.PLAIN, 15)); lblForMyOther.setBounds(25, 321, 502, 24); contentPane.add(lblForMyOther); JLabel lblMySensei2 = new JLabel("Karun Sensei"); lblMySensei2.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMySensei2.setBounds(25, 120, 242, 24); contentPane.add(lblMySensei2); JLabel lblMySensei1 = new JLabel("Prashotam Sensei"); lblMySensei1.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMySensei1.setBounds(25, 98, 242, 24); contentPane.add(lblMySensei1); JLabel lblDaretobe = new JLabel("D4r3T0B3"); lblDaretobe.setFont(new Font("Dialog", Font.PLAIN, 15)); lblDaretobe.setBounds(25, 194, 242, 24); contentPane.add(lblDaretobe); JLabel label_9 = new JLabel(""); label_9.setToolTipText("This variation of android robot is created using Androidify"); label_9.setIcon(new ImageIcon(About.class.getResource("/graphics/Droidrobot.png"))); label_9.setBounds(334, 50, 180, 270); contentPane.add(label_9); JLabel lblDeveloper = new JLabel("Developer"); lblDeveloper.setFont(new Font("Dialog", Font.BOLD, 16)); lblDeveloper.setBounds(25, 12, 233, 24); contentPane.add(lblDeveloper); JLabel lblMrAleksandarDespotovski_shi = new JLabel("Aleksandar Despotovski-shi"); lblMrAleksandarDespotovski_shi.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMrAleksandarDespotovski_shi.setBounds(25, 169, 242, 24); contentPane.add(lblMrAleksandarDespotovski_shi); JLabel lblMyname = new JLabel("Karanvir Singh"); lblMyname.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { Desktop.getDesktop().browse(new URL( "http://forum.xda-developers.com/member.php?s=82fb1dacfee601c8f79084b30d57d5a2&u=5640594") .toURI()); } catch (Exception e1) { e1.printStackTrace(); } } @Override public void mouseEntered(MouseEvent e) { lblMyname.setForeground(Color.BLUE); } @Override public void mouseExited(MouseEvent e) { lblMyname.setForeground(Color.RED); } }); lblMyname.setForeground(Color.RED); lblMyname.setFont(new Font("Dialog", Font.BOLD | Font.ITALIC, 16)); lblMyname.setBounds(25, 36, 242, 24); contentPane.add(lblMyname); JLabel lblMyFriend1 = new JLabel("My friend - Chetan-kun"); lblMyFriend1.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend1.setBounds(25, 145, 242, 24); contentPane.add(lblMyFriend1); JLabel label_6 = new JLabel("Special thanks to"); label_6.setForeground(UIManager.getColor("OptionPane.questionDialog.titlePane.shadow")); label_6.setFont(new Font("Dialog", Font.BOLD, 16)); label_6.setBounds(25, 71, 240, 25); contentPane.add(label_6); JLabel lblGoogle = new JLabel( "Android, android green colored robot are trademarks of Google, Inc. We are not affliated with Google, Inc. in any way."); lblGoogle.setHorizontalAlignment(SwingConstants.LEFT); lblGoogle.setFont(new Font("Dialog", Font.PLAIN, 8)); lblGoogle.setBounds(25, 341, 514, 24); contentPane.add(lblGoogle); }
From source file:com.francetelecom.rd.dashboard.pc.DashboardPC.java
private void initDashboardWithRules() { // get existing rules and display them try {//from w w w. j a v a 2 s . com Rule[] ruleList = busConnector.getAllRules(); for (int i = 0; i < ruleList.length; i++) { if (!ruleList[i].isPrivate()) addRulePanelToDashboard(ruleList[i].getId()); } } catch (HomeBusException e) { logger.error("Could not retrieve bus rules : " + e.getMessage()); e.printStackTrace(); } // small add rule panel init JPanel panelAddRule = new JPanel(); panelAddRule.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); panelAddRule.setLayout(null); JLabel addRuleLbl = new JLabel("Configure new rule"); addRuleLbl.setHorizontalAlignment(SwingConstants.CENTER); addRuleLbl.setForeground(new Color(169, 169, 169)); addRuleLbl.setFont(new Font("Arial", Font.BOLD, 13)); addRuleLbl.setBounds(10, 25, 229, 27); panelAddRule.add(addRuleLbl); JButton addRuleBtn = new JButton("+"); addRuleBtn.setForeground(new Color(128, 128, 128)); addRuleBtn.setBounds(100, 57, 41, 23); panelAddRule.add(addRuleBtn); rulesContent.add(panelAddRule); myRulePanelMap.put("0", panelAddRule); updateRuleListDisplay(); // add panel elements : photo, service friendly name, IF label, condition parameter JPanel panelRule1 = new JPanel(); panelRule1.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); panelRule1.setLayout(null); JPanel rulePanelServicePhoto1 = new JPanel(); rulePanelServicePhoto1.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); rulePanelServicePhoto1.setBounds(10, 16, 27, 27); panelRule1.add(rulePanelServicePhoto1); String serviceName1 = "Visio TV"; JLabel ruleLblServiceName1 = new JLabel(serviceName1); ruleLblServiceName1.setFont(new Font("Arial", Font.BOLD, 15)); ruleLblServiceName1.setForeground(new Color(100, 149, 237)); ruleLblServiceName1.setBounds(47, 11, 212, 18); panelRule1.add(ruleLblServiceName1); String serviceDeviceOwner1 = "Set-top Box"; JLabel ruleLblOnDevice1 = new JLabel("on " + serviceDeviceOwner1); ruleLblOnDevice1.setForeground(Color.GRAY); ruleLblOnDevice1.setFont(new Font("Arial", Font.PLAIN, 11)); ruleLblOnDevice1.setBounds(47, 29, 212, 14); panelRule1.add(ruleLblOnDevice1); JLabel ruleLblIf1 = new JLabel("IF"); ruleLblIf1.setForeground(Color.GRAY); ruleLblIf1.setFont(new Font("Arial", Font.BOLD, 30)); ruleLblIf1.setBounds(10, 49, 27, 35); panelRule1.add(ruleLblIf1); // condition String condition1 = "IncomingVoIP" + " = " + "true"; JLabel ruleLblConditionParam1 = new JLabel(condition1); ruleLblConditionParam1.setFont(new Font("Arial", Font.BOLD, 13)); ruleLblConditionParam1.setForeground(Color.GRAY); ruleLblConditionParam1.setBounds(47, 49, 192, 35); panelRule1.add(ruleLblConditionParam1); myRulePanelMap.put("1", panelRule1); rulesContent.add(panelRule1); // add panel elements : photo, service friendly name, IF label, condition parameter JPanel panelRule2 = new JPanel(); panelRule2.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); panelRule2.setLayout(null); JPanel rulePanelServicePhoto2 = new JPanel(); rulePanelServicePhoto2.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null)); rulePanelServicePhoto2.setBounds(10, 16, 27, 27); panelRule2.add(rulePanelServicePhoto2); String serviceName2 = "Wi-Fi Off"; JLabel ruleLblServiceName2 = new JLabel(serviceName2); ruleLblServiceName2.setFont(new Font("Arial", Font.BOLD, 15)); ruleLblServiceName2.setForeground(new Color(100, 149, 237)); ruleLblServiceName2.setBounds(47, 11, 212, 18); panelRule2.add(ruleLblServiceName2); String serviceDeviceOwner2 = "Livebox"; JLabel ruleLblOnDevice2 = new JLabel("on " + serviceDeviceOwner2); ruleLblOnDevice2.setForeground(Color.GRAY); ruleLblOnDevice2.setFont(new Font("Arial", Font.PLAIN, 11)); ruleLblOnDevice2.setBounds(47, 29, 212, 14); panelRule2.add(ruleLblOnDevice2); JLabel ruleLblIf2 = new JLabel("IF"); ruleLblIf2.setForeground(Color.GRAY); ruleLblIf2.setFont(new Font("Arial", Font.BOLD, 30)); ruleLblIf2.setBounds(10, 49, 27, 35); panelRule2.add(ruleLblIf2); // condition String condition2 = "Absence" + " = " + "true"; JLabel ruleLblConditionParam2 = new JLabel(condition2); ruleLblConditionParam2.setFont(new Font("Arial", Font.BOLD, 13)); ruleLblConditionParam2.setForeground(Color.GRAY); ruleLblConditionParam2.setBounds(47, 49, 192, 35); panelRule2.add(ruleLblConditionParam2); myRulePanelMap.put("2", panelRule2); rulesContent.add(panelRule2); updateRuleListDisplay(); busConnector.addRuleDefinitionsListener(this); }
From source file:gov.nih.nci.nbia.StandaloneDMV3.java
private JPanel constructLoginPanel() { JPanel contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(36, 36, 36, 36)); contentPane.setLayout(null);//from w w w .j a va2 s. c om JPanel guestPanel = new JPanel(); guestPanel.setBounds(38, 40, 825, 140); guestPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED, new Color(153, 180, 209), null), " For Guest ", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(0, 120, 215))); contentPane.add(guestPanel); guestPanel.setLayout(null); JButton guestBtn = new JButton(GuestBtnLbl); guestBtn.setBounds(606, 50, 140, 36); guestBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { submitRequest(null, null); } }); guestPanel.add(guestBtn); JLabel guestLbl = new JLabel("Log in as a guest to download public data only"); guestLbl.setBounds(70, 50, 460, 42); guestPanel.add(guestLbl); JPanel loginUserPanel = new JPanel(); loginUserPanel.setBounds(40, 258, 825, 306); contentPane.add(loginUserPanel); loginUserPanel .setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, new Color(153, 180, 209), null), " Login to Download Authorized Data ", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(0, 120, 215))); loginUserPanel.setLayout(null); JLabel lblNewLabel_1 = new JLabel("User Name"); lblNewLabel_1.setBounds(70, 80, 118, 36); loginUserPanel.add(lblNewLabel_1); JButton submitBtn = new JButton(SubmitBtnLbl); submitBtn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { userId = userNameFld.getText(); password = passwdFld.getText(); if ((userId.length() < 1) || (password.length() < 1)) { statusLbl.setText("Please enter a valid user name and password."); statusLbl.setForeground(Color.red); } else { submitRequest(userId, password); } } }); submitBtn.setBounds(606, 238, 140, 36); loginUserPanel.add(submitBtn); userNameFld = new JTextField(); userNameFld.setBounds(200, 80, 333, 36); loginUserPanel.add(userNameFld); userNameFld.setColumns(10); JLabel lblPassword = new JLabel("Password"); lblPassword.setBounds(70, 156, 118, 36); loginUserPanel.add(lblPassword); passwdFld = new JPasswordField(); passwdFld.setBounds(200, 156, 333, 36); loginUserPanel.add(passwdFld); statusLbl = new JLabel(""); statusLbl.setBounds(70, 226, 463, 36); loginUserPanel.add(statusLbl); JLabel lblOr = new JLabel("--- OR ---"); lblOr.setBounds(419, 212, 81, 26); contentPane.add(lblOr); JLabel versionLabel = new JLabel("Release " + DownloaderProperties.getAppVersion() + " Build \"" + DownloaderProperties.getBuildTime() + "\""); versionLabel.setHorizontalAlignment(SwingConstants.CENTER); versionLabel.setForeground(new Color(70, 130, 180)); versionLabel.setBounds(315, 584, 260, 20); contentPane.add(versionLabel); userNameFld.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { passwdFld.requestFocus(); } }); userNameFld.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { statusLbl.setText(""); } @Override public void focusLost(FocusEvent e) { } }); passwdFld.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { userId = userNameFld.getText(); password = passwdFld.getText(); if ((userId.length() < 1) || (password.length() < 1)) { statusLbl.setText("Please enter a valid user name and password."); statusLbl.setForeground(Color.red); } else submitRequest(userId, password); } }); passwdFld.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent e) { statusLbl.setText(""); } @Override public void focusLost(FocusEvent e) { } }); return contentPane; }
From source file:LicenseGenerator.java
/** * Initialize the contents of the frame. *//*from w w w .j a va 2 s. co m*/ private void initialize() { try { UIManager.setLookAndFeel(new WindowsLookAndFeel()); } catch (UnsupportedLookAndFeelException ex) { } m_frame = new JFrame(); m_frame.setTitle("License?"); m_frame.setResizable(false); m_frame.setBounds(100, 100, 496, 483); m_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); m_frame.getContentPane().setLayout(null); chkDate = new JCheckBox("?"); chkDate.setSelected(true); chkDate.setBounds(6, 6, 103, 23); m_frame.getContentPane().add(chkDate); txtDate = new JTextField(); txtDate.setText("20131231"); txtDate.setHorizontalAlignment(SwingConstants.RIGHT); txtDate.setBounds(131, 7, 193, 21); m_frame.getContentPane().add(txtDate); txtDate.setColumns(10); chkAdapterNum = new JCheckBox("???"); chkAdapterNum.setSelected(true); chkAdapterNum.setBounds(6, 37, 119, 23); m_frame.getContentPane().add(chkAdapterNum); txtAdapterNum = new JTextField(); txtAdapterNum.setText("000012"); txtAdapterNum.setHorizontalAlignment(SwingConstants.RIGHT); txtAdapterNum.setColumns(10); txtAdapterNum.setBounds(131, 38, 193, 21); m_frame.getContentPane().add(txtAdapterNum); chkAdapter = new JCheckBox( "??? (?? ???)"); chkAdapter.setSelected(true); chkAdapter.setBounds(6, 76, 465, 23); m_frame.getContentPane().add(chkAdapter); chkHTTP_C = new JCheckBox("http.c"); chkHTTP_C.setSelected(true); chkHTTP_C.setBounds(43, 130, 76, 23); m_frame.getContentPane().add(chkHTTP_C); txtHTTP_C = new JTextField(); txtHTTP_C.setText("20131231"); txtHTTP_C.setHorizontalAlignment(SwingConstants.RIGHT); txtHTTP_C.setBounds(131, 131, 103, 21); m_frame.getContentPane().add(txtHTTP_C); txtHTTP_C.setColumns(10); chkSOAP_C = new JCheckBox("soap.c"); chkSOAP_C.setSelected(true); chkSOAP_C.setBounds(43, 161, 76, 23); m_frame.getContentPane().add(chkSOAP_C); txtSOAP_C = new JTextField(); txtSOAP_C.setText("20131231"); txtSOAP_C.setHorizontalAlignment(SwingConstants.RIGHT); txtSOAP_C.setColumns(10); txtSOAP_C.setBounds(131, 162, 103, 21); m_frame.getContentPane().add(txtSOAP_C); chkTCP_C = new JCheckBox("tcp.c"); chkTCP_C.setSelected(true); chkTCP_C.setBounds(43, 192, 76, 23); m_frame.getContentPane().add(chkTCP_C); txtTCP_C = new JTextField(); txtTCP_C.setText("20131231"); txtTCP_C.setHorizontalAlignment(SwingConstants.RIGHT); txtTCP_C.setColumns(10); txtTCP_C.setBounds(131, 193, 103, 21); m_frame.getContentPane().add(txtTCP_C); chkUDP_C = new JCheckBox("udp.c"); chkUDP_C.setSelected(true); chkUDP_C.setBounds(43, 223, 76, 23); m_frame.getContentPane().add(chkUDP_C); txtUDP_C = new JTextField(); txtUDP_C.setText("20131231"); txtUDP_C.setHorizontalAlignment(SwingConstants.RIGHT); txtUDP_C.setColumns(10); txtUDP_C.setBounds(131, 224, 103, 21); m_frame.getContentPane().add(txtUDP_C); chkTUXEDO_C = new JCheckBox("tuxedo.c"); chkTUXEDO_C.setSelected(true); chkTUXEDO_C.setBounds(43, 254, 76, 23); m_frame.getContentPane().add(chkTUXEDO_C); txtTUXEDO_C = new JTextField(); txtTUXEDO_C.setText("20131231"); txtTUXEDO_C.setHorizontalAlignment(SwingConstants.RIGHT); txtTUXEDO_C.setColumns(10); txtTUXEDO_C.setBounds(131, 255, 103, 21); m_frame.getContentPane().add(txtTUXEDO_C); chkMQ_C = new JCheckBox("mq.c"); chkMQ_C.setSelected(true); chkMQ_C.setBounds(43, 286, 76, 23); m_frame.getContentPane().add(chkMQ_C); txtMQ_C = new JTextField(); txtMQ_C.setText("20131231"); txtMQ_C.setHorizontalAlignment(SwingConstants.RIGHT); txtMQ_C.setColumns(10); txtMQ_C.setBounds(131, 287, 103, 21); m_frame.getContentPane().add(txtMQ_C); chkHTTP_S = new JCheckBox("http.s"); chkHTTP_S.setSelected(true); chkHTTP_S.setBounds(283, 130, 76, 23); m_frame.getContentPane().add(chkHTTP_S); txtHTTP_S = new JTextField(); txtHTTP_S.setText("20131231"); txtHTTP_S.setHorizontalAlignment(SwingConstants.RIGHT); txtHTTP_S.setColumns(10); txtHTTP_S.setBounds(368, 130, 103, 21); m_frame.getContentPane().add(txtHTTP_S); chkSOAP_S = new JCheckBox("soap.s"); chkSOAP_S.setSelected(true); chkSOAP_S.setBounds(283, 161, 76, 23); m_frame.getContentPane().add(chkSOAP_S); txtSOAP_S = new JTextField(); txtSOAP_S.setText("20131231"); txtSOAP_S.setHorizontalAlignment(SwingConstants.RIGHT); txtSOAP_S.setColumns(10); txtSOAP_S.setBounds(368, 161, 103, 21); m_frame.getContentPane().add(txtSOAP_S); chkTCP_S = new JCheckBox("tcp.s"); chkTCP_S.setSelected(true); chkTCP_S.setBounds(283, 192, 76, 23); m_frame.getContentPane().add(chkTCP_S); txtTCP_S = new JTextField(); txtTCP_S.setText("20131231"); txtTCP_S.setHorizontalAlignment(SwingConstants.RIGHT); txtTCP_S.setColumns(10); txtTCP_S.setBounds(368, 192, 103, 21); m_frame.getContentPane().add(txtTCP_S); chkUDP_S = new JCheckBox("udp.s"); chkUDP_S.setSelected(true); chkUDP_S.setBounds(283, 223, 76, 23); m_frame.getContentPane().add(chkUDP_S); txtUDP_S = new JTextField(); txtUDP_S.setText("20131231"); txtUDP_S.setHorizontalAlignment(SwingConstants.RIGHT); txtUDP_S.setColumns(10); txtUDP_S.setBounds(368, 223, 103, 21); m_frame.getContentPane().add(txtUDP_S); chkTUXEDO_S = new JCheckBox("tuxedo.s"); chkTUXEDO_S.setSelected(true); chkTUXEDO_S.setBounds(283, 254, 76, 23); m_frame.getContentPane().add(chkTUXEDO_S); txtTUXEDO_S = new JTextField(); txtTUXEDO_S.setText("20131231"); txtTUXEDO_S.setHorizontalAlignment(SwingConstants.RIGHT); txtTUXEDO_S.setColumns(10); txtTUXEDO_S.setBounds(368, 254, 103, 21); m_frame.getContentPane().add(txtTUXEDO_S); chkMQ_S = new JCheckBox("mq.s"); chkMQ_S.setSelected(true); chkMQ_S.setBounds(283, 286, 76, 23); m_frame.getContentPane().add(chkMQ_S); txtMQ_S = new JTextField(); txtMQ_S.setText("20131231"); txtMQ_S.setHorizontalAlignment(SwingConstants.RIGHT); txtMQ_S.setColumns(10); txtMQ_S.setBounds(368, 286, 103, 21); m_frame.getContentPane().add(txtMQ_S); JLabel lblAdapterType1 = new JLabel("???"); lblAdapterType1.setBounds(43, 105, 115, 15); m_frame.getContentPane().add(lblAdapterType1); JLabel lblAdapterType2 = new JLabel("??"); lblAdapterType2.setBounds(283, 105, 103, 15); m_frame.getContentPane().add(lblAdapterType2); JLabel lblAdapterDate1 = new JLabel("?"); lblAdapterDate1.setHorizontalAlignment(SwingConstants.RIGHT); lblAdapterDate1.setBounds(168, 106, 66, 15); m_frame.getContentPane().add(lblAdapterDate1); JLabel lblAdapterDate2 = new JLabel("?"); lblAdapterDate2.setHorizontalAlignment(SwingConstants.RIGHT); lblAdapterDate2.setBounds(405, 105, 66, 15); m_frame.getContentPane().add(lblAdapterDate2); JButton cmdLicense = new JButton("?license"); cmdLicense.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { cmdLicense_click(e); } }); cmdLicense.setBounds(302, 332, 169, 23); m_frame.getContentPane().add(cmdLicense); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(6, 367, 478, 82); m_frame.getContentPane().add(scrollPane); txtLicense = new JTextArea(); txtLicense.setEditable(false); scrollPane.setViewportView(txtLicense); }
From source file:utybo.easypastebin.windows.MainWindow.java
/** * Creates the window/*from ww w . ja v a 2 s . co m*/ */ @SuppressWarnings({ "rawtypes", "unchecked" }) public MainWindow() { EasyPastebin.LOGGER.log("Initializing the window", SinkJLevel.INFO); setTitle("EasyPastebin"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 664, 431); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP); contentPane.add(tabbedPane, BorderLayout.CENTER); JPanel main = new JPanel(); tabbedPane.addTab("EasyPastebin", null, main, null); main.setLayout(null); JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(62, 39, 312, 132); main.add(scrollPane); pasteContent = new JTextArea(); pasteContent.setFont(new Font("Monospaced", Font.PLAIN, 11)); pasteContent.setWrapStyleWord(true); pasteContent.setLineWrap(true); pasteContent.setToolTipText("Put your paste here!"); scrollPane.setViewportView(pasteContent); JLabel titleLabel = new JLabel("Title :"); titleLabel.setFont(new Font("Tahoma", Font.PLAIN, 12)); titleLabel.setBounds(10, 11, 42, 21); main.add(titleLabel); pasteTitle = new JTextField(); pasteTitle.setBounds(62, 12, 312, 20); main.add(pasteTitle); pasteTitle.setColumns(10); JLabel lblPaste = new JLabel("Paste :"); lblPaste.setForeground(Color.RED); lblPaste.setFont(new Font("Tahoma", Font.PLAIN, 12)); lblPaste.setBounds(10, 85, 53, 21); main.add(lblPaste); pasteExpireDate = new JComboBox(); pasteExpireDate.setFont(new Font("Tahoma", Font.PLAIN, 12)); pasteExpireDate.setModel(new DefaultComboBoxModel(EnumExpireDate.values())); pasteExpireDate.setBounds(468, 12, 155, 21); main.add(pasteExpireDate); JLabel lblExpireDate = new JLabel("Expire Date :"); lblExpireDate.setFont(new Font("Tahoma", Font.PLAIN, 12)); lblExpireDate.setBounds(384, 14, 81, 14); main.add(lblExpireDate); JLabel lblfieldsInRed = new JLabel("(Fields in red are required)"); lblfieldsInRed.setBounds(72, 182, 302, 14); main.add(lblfieldsInRed); btnSubmit = new JButton("Submit!"); btnSubmit.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent event) { EasyPastebin.LOGGER.log("Starting Submit script", SinkJLevel.INFO); btnSubmit.setEnabled(false); btnSubmit.setText("Please wait..."); boolean success = true; String paste = pasteContent.getText(); String title = pasteTitle.getText(); EnumExpireDate expireDate = (EnumExpireDate) pasteExpireDate.getSelectedItem(); if (paste.equals("") || paste.equals(" ") || paste.equals(null)) { pastebinUrl.setText("ERROR"); JOptionPane.showMessageDialog(null, "You cannot send empty pastes!", "Error while processing paste", JOptionPane.ERROR_MESSAGE); } else { try { EasyPastebin.LOGGER.log("Setting options", SinkJLevel.INFO); Map map = new HashMap<String, String>(); map.put("api_dev_key", HttpHelper.API_KEY); map.put("api_option", "paste"); map.put("api_paste_code", paste); if (!(expireDate.equals(null) || expireDate.equals(EnumExpireDate.NEVER))) map.put("api_paste_expire_date", expireDate.getRawName()); if (!(title.equals("") || title.equals(" ") || title.equals(null))) map.put("api_paste_name", title); EasyPastebin.LOGGER.log("Sending paste", SinkJLevel.INFO); String actionResult = HttpHelper.sendPost("http://pastebin.com/api/api_post.php", map) .asString(); EasyPastebin.LOGGER.log("Paste sent, checking output", SinkJLevel.INFO); // Exception handlers if (actionResult.equals("Bad API request, invalid api_option")) { success = false; EasyPastebin.LOGGER.log( "The output is an error message : " + actionResult + ". Submit script failed!", SinkJLevel.ERROR); JOptionPane.showMessageDialog(null, "Error while processing paste. Incorrect Pastebin option!", "Error", JOptionPane.ERROR_MESSAGE); } if (actionResult.equals("Bad API request, invalid api_dev_key")) { success = false; EasyPastebin.LOGGER.log( "The output is an error message : " + actionResult + ". Submit script failed!", SinkJLevel.ERROR); JOptionPane.showMessageDialog(null, "Error while processing paste. Incorrect dev key! Try again with a more recent version!", "Error", JOptionPane.ERROR_MESSAGE); } if (actionResult.equals("Bad API request, IP blocked")) { success = false; EasyPastebin.LOGGER.log( "The output is an error message : " + actionResult + ". Submit script failed!", SinkJLevel.ERROR); JOptionPane.showMessageDialog(null, "Error while processing paste. Your IP is blocked!", "Error", JOptionPane.ERROR_MESSAGE); } if (actionResult.equals( "Bad API request, maximum number of 25 unlisted pastes for your free account")) { success = false; EasyPastebin.LOGGER.log( "The output is an error message : " + actionResult + ". Submit script failed!", SinkJLevel.ERROR); } if (actionResult.equals( "Bad API request, maximum number of 10 private pastes for your free account")) { success = false; EasyPastebin.LOGGER.log( "The output is an error message : " + actionResult + ". Submit script failed!", SinkJLevel.ERROR); } if (actionResult.equals("Bad API request, api_paste_code was empty")) { success = false; EasyPastebin.LOGGER.log( "The output is an error message : " + actionResult + ". Submit script failed!", SinkJLevel.ERROR); } if (actionResult.equals("Bad API request, maximum paste file size exceeded")) { success = false; EasyPastebin.LOGGER.log( "The output is an error message : " + actionResult + ". Submit script failed!", SinkJLevel.ERROR); JOptionPane.showMessageDialog(null, "Error while processing paste. Your paste is too big!", "Error", JOptionPane.ERROR_MESSAGE); } if (actionResult.equals("Bad API request, invalid api_expire_date")) { success = false; EasyPastebin.LOGGER.log( "The output is an error message : " + actionResult + ". Submit script failed!", SinkJLevel.ERROR); JOptionPane.showMessageDialog(null, "Error while processing paste. Invalid expire date!", "Error", JOptionPane.ERROR_MESSAGE); } if (actionResult.equals("Bad API request, invalid api_paste_private")) { success = false; EasyPastebin.LOGGER.log( "The output is an error message : " + actionResult + ". Submit script failed!", SinkJLevel.ERROR); JOptionPane.showMessageDialog(null, "Error while processing paste. Invalid privacy value!", "Error", JOptionPane.ERROR_MESSAGE); } if (actionResult.equals("Bad API request, invalid api_paste_format")) { success = false; EasyPastebin.LOGGER.log( "The output is an error message : " + actionResult + ". Submit script failed!", SinkJLevel.ERROR); JOptionPane.showMessageDialog(null, "Error while processing paste. Invalid format!", "Error", JOptionPane.ERROR_MESSAGE); } // END // Starting display stuff if (success == false) { EasyPastebin.LOGGER.log("Submit script failed : success == false", SinkJLevel.ERROR); pastebinUrl.setText("ERROR"); } if (success == true) { EasyPastebin.LOGGER.log("Paste sent! Starting display script!", SinkJLevel.INFO); pastebinUrl.setText(actionResult); JOptionPane.showMessageDialog(null, "Paste successfully sent!", "Done!", JOptionPane.INFORMATION_MESSAGE); EasyPastebin.LOGGER.log("Display script finished! Paste URL is : " + actionResult, SinkJLevel.INFO); } } catch (ClientProtocolException e) { EasyPastebin.LOGGER.log("Unexpected error! " + e, SinkJLevel.ERROR); JOptionPane.showMessageDialog(null, "Error while processing paste : " + e, "Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } catch (IOException e) { EasyPastebin.LOGGER.log("Unexpected error! " + e, SinkJLevel.ERROR); JOptionPane.showMessageDialog(null, "Error while processing paste : " + e, "Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } catch (MissingParamException e) { EasyPastebin.LOGGER.log("Unexpected error! " + e, SinkJLevel.ERROR); JOptionPane.showMessageDialog(null, "Error while processing paste : " + e + "! This is a severe programming error! Try again with a more recent version!", "Error", JOptionPane.ERROR_MESSAGE); e.printStackTrace(); } } EasyPastebin.LOGGER.log("Re-enabling the Submit button ", SinkJLevel.INFO); btnSubmit.setEnabled(true); btnSubmit.setText("Submit another paste!"); EasyPastebin.LOGGER.log("Finished submit script! Success : " + success, SinkJLevel.INFO); } }); btnSubmit.setBounds(386, 45, 237, 44); main.add(btnSubmit); pastebinUrl = new JTextField(); pastebinUrl.setText("The paste's URL will be shown here!"); pastebinUrl.setEditable(false); pastebinUrl.setBounds(384, 198, 239, 32); main.add(pastebinUrl); pastebinUrl.setColumns(10); JPanel about = new JPanel(); tabbedPane.addTab("About", null, about, null); JLabel label = new JLabel("EasyPastebin"); label.setBounds(12, 12, 623, 39); label.setHorizontalAlignment(SwingConstants.CENTER); label.setFont(new Font("Dialog", Font.PLAIN, 25)); JLabel lblTheEasiestWay = new JLabel("The easiest way to use Pastebin.com"); lblTheEasiestWay.setBounds(12, 63, 623, 32); lblTheEasiestWay.setFont(new Font("Dialog", Font.PLAIN, 16)); lblTheEasiestWay.setHorizontalAlignment(SwingConstants.CENTER); about.setLayout(null); about.add(label); about.add(lblTheEasiestWay); JButton btnForkM = new JButton("Fork me on Github!"); btnForkM.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { goToUrl("https://github.com/utybo/EasyPastebin"); } }); btnForkM.setBounds(12, 117, 623, 25); about.add(btnForkM); JButton btnCheckOutUtybos = new JButton("Check out utybo's projects!"); btnCheckOutUtybos.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { goToUrl("http://utybo.github.io/"); } }); btnCheckOutUtybos.setBounds(12, 154, 623, 25); about.add(btnCheckOutUtybos); JButton btnGoToPastebincom = new JButton("Go to Pastebin.com!"); btnGoToPastebincom.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { goToUrl("http://www.pastebin.com"); } }); btnGoToPastebincom.setBounds(12, 191, 623, 25); about.add(btnGoToPastebincom); JLabel lblcUtybo = new JLabel( "This soft was made by utybo. It uses Apache's libraries for the interaction with Pastebin's API"); lblcUtybo.setFont(new Font("Dialog", Font.PLAIN, 10)); lblcUtybo.setHorizontalAlignment(SwingConstants.CENTER); lblcUtybo.setBounds(12, 324, 623, 15); about.add(lblcUtybo); JLabel lblClickMeTo = new JLabel("Click me to go to Apache's licence official website"); lblClickMeTo.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { goToUrl("http://www.apache.org/licenses/LICENSE-2.0"); } }); lblClickMeTo.setHorizontalAlignment(SwingConstants.CENTER); lblClickMeTo.setFont(new Font("Dialog", Font.PLAIN, 10)); lblClickMeTo.setBounds(12, 342, 623, 15); about.add(lblClickMeTo); setVisible(true); EasyPastebin.LOGGER.log("Done!", SinkJLevel.INFO); }
From source file:be.ac.ua.comp.scarletnebula.gui.windows.GUI.java
private JPanel getOverlayPanel() { final JPanel overlayPanel = new JPanel(); overlayPanel.setOpaque(false);//from w ww. j ava 2s . co m overlayPanel.setLayout(new GridBagLayout()); filterTextField.addKeyListener(new KeyListener() { @Override public void keyTyped(final KeyEvent e) { } @Override public void keyReleased(final KeyEvent e) { } @Override public void keyPressed(final KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { hideFilter(); } } }); filterTextField.getDocument().addDocumentListener(new DocumentListener() { @Override public void removeUpdate(final DocumentEvent e) { textChanged(); } @Override public void insertUpdate(final DocumentEvent e) { textChanged(); } @Override public void changedUpdate(final DocumentEvent e) { } private void textChanged() { serverListModel.filter(filterTextField.getText()); } }); final SearchField searchField = new SearchField(filterTextField); final ImageIcon closeIcon = Utils.icon("cross16.png"); final JButton closeButton = new JButton(closeIcon); closeButton.setBounds(10, 10, closeIcon.getIconWidth(), closeIcon.getIconHeight()); closeButton.setMargin(new Insets(0, 0, 0, 0)); closeButton.setOpaque(false); closeButton.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4)); closeButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { hideFilter(); } }); searchPanel.add(searchField); searchPanel.add(closeButton); // searchPanel.setBorder(BorderFactory // .createBevelBorder(BevelBorder.RAISED)); searchPanel.setBorder(BorderFactory.createEtchedBorder()); searchPanel.setVisible(false); searchPanel.setAlignmentX(RIGHT_ALIGNMENT); final GridBagConstraints c = new GridBagConstraints(); c.anchor = GridBagConstraints.LAST_LINE_END; c.fill = GridBagConstraints.NONE; c.gridx = 0; c.gridy = 0; c.weightx = 1.0; c.weighty = 1.0; c.insets = new Insets(3, 3, 3, 3); overlayPanel.add(searchPanel, c); return overlayPanel; }
From source file:ConfigFiles.java
public ConfigFiles(Dimension screensize) { // initializeFileBrowser(); paths = new JPanel(); paths.setBackground(Color.WHITE); //paths.setBorder(BorderFactory.createTitledBorder("Paths")); paths.setLayout(null);/*from www. ja v a 2 s .com*/ paths.setPreferredSize(new Dimension(930, 1144)); paths.setSize(new Dimension(930, 1144)); paths.setMinimumSize(new Dimension(930, 1144)); paths.setMaximumSize(new Dimension(930, 1144)); //paths.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); setLayout(null); ttcpath = new JTextField(); addPanel("TestCase Source Path", "Master directory with the test cases that can" + " be run by the framework", ttcpath, RunnerRepository.TESTSUITEPATH, 10, true, null); tMasterXML = new JTextField(); tUsers = new JTextField(); addPanel("Projects Path", "Location of projects XML files", tUsers, RunnerRepository.REMOTEUSERSDIRECTORY, 83, true, null); tSuites = new JTextField(); addPanel("Predefined Suites Path", "Location of predefined suites", tSuites, RunnerRepository.PREDEFINEDSUITES, 156, true, null); testconfigpath = new JTextField(); addPanel("Test Configuration Path", "Test Configuration path", testconfigpath, RunnerRepository.TESTCONFIGPATH, 303, true, null); tepid = new JTextField(); addPanel("EP name File", "Location of the file that contains" + " the Ep name list", tepid, RunnerRepository.REMOTEEPIDDIR, 595, true, null); tlog = new JTextField(); addPanel("Logs Path", "Location of the directory that stores the most recent log files." + " The files are re-used each Run.", tlog, RunnerRepository.LOGSPATH, 667, true, null); tsecondarylog = new JTextField(); JPanel p = addPanel("Secondary Logs Path", "Location of the directory that archives copies of the most recent log files, with" + " original file names appended with <.epoch time>", tsecondarylog, RunnerRepository.SECONDARYLOGSPATH, 930, true, null); logsenabled.setSelected(Boolean.parseBoolean(RunnerRepository.PATHENABLED)); logsenabled.setBackground(Color.WHITE); p.add(logsenabled); JPanel p7 = new JPanel(); p7.setBackground(Color.WHITE); TitledBorder border7 = BorderFactory.createTitledBorder("Log Files"); border7.setTitleFont(new Font("Arial", Font.PLAIN, 14)); border7.setBorder(BorderFactory.createLineBorder(new Color(150, 150, 150), 1)); p7.setBorder(border7); p7.setLayout(new BoxLayout(p7, BoxLayout.Y_AXIS)); p7.setBounds(80, 740, 800, 190); paths.add(p7); JTextArea log2 = new JTextArea("All the log files that will be monitored"); log2.setWrapStyleWord(true); log2.setLineWrap(true); log2.setEditable(false); log2.setCursor(null); log2.setOpaque(false); log2.setFocusable(false); log2.setBorder(null); log2.setFont(new Font("Arial", Font.PLAIN, 12)); log2.setBackground(getBackground()); log2.setMaximumSize(new Dimension(170, 25)); log2.setPreferredSize(new Dimension(170, 25)); JPanel p71 = new JPanel(); p71.setBackground(Color.WHITE); p71.setLayout(new GridLayout()); p71.setMaximumSize(new Dimension(700, 13)); p71.setPreferredSize(new Dimension(700, 13)); p71.add(log2); JPanel p72 = new JPanel(); p72.setBackground(Color.WHITE); p72.setLayout(new BoxLayout(p72, BoxLayout.Y_AXIS)); trunning = new JTextField(); p72.add(addField(trunning, "Running: ", 0)); tdebug = new JTextField(); p72.add(addField(tdebug, "Debug: ", 1)); tsummary = new JTextField(); p72.add(addField(tsummary, "Summary: ", 2)); tinfo = new JTextField(); p72.add(addField(tinfo, "Info: ", 3)); tcli = new JTextField(); p72.add(addField(tcli, "Cli: ", 4)); p7.add(p71); p7.add(p72); libpath = new JTextField(); addPanel("Library path", "Secondary user library path", libpath, RunnerRepository.REMOTELIBRARY, 229, true, null); JPanel p8 = new JPanel(); p8.setBackground(Color.WHITE); TitledBorder border8 = BorderFactory.createTitledBorder("File"); border8.setTitleFont(new Font("Arial", Font.PLAIN, 14)); border8.setBorder(BorderFactory.createLineBorder(new Color(150, 150, 150), 1)); p8.setBorder(border8); p8.setLayout(null); p8.setBounds(80, 1076, 800, 50); if (PermissionValidator.canChangeFWM()) { paths.add(p8); } JButton save = new JButton("Save"); save.setToolTipText("Save and automatically load config"); save.setBounds(490, 20, 70, 20); save.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { saveXML(false, "fwmconfig"); loadConfig("fwmconfig.xml"); } }); p8.add(save); // if(!PermissionValidator.canChangeFWM()){ // save.setEnabled(false); // } JButton saveas = new JButton("Save as"); saveas.setBounds(570, 20, 90, 20); saveas.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { String filename = CustomDialog.showInputDialog(JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, ConfigFiles.this, "File Name", "Please enter file name"); if (!filename.equals("NULL")) { saveXML(false, filename); } } }); p8.add(saveas); final JButton loadXML = new JButton("Load Config"); loadXML.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { try { String[] configs = RunnerRepository .getRemoteFolderContent(RunnerRepository.USERHOME + "/twister/config/"); JComboBox combo = new JComboBox(configs); int resp = (Integer) CustomDialog.showDialog(combo, JOptionPane.INFORMATION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, ConfigFiles.this, "Config", null); final String config; if (resp == JOptionPane.OK_OPTION) config = combo.getSelectedItem().toString(); else config = null; if (config != null) { new Thread() { public void run() { setEnabledTabs(false); JFrame progress = new JFrame(); progress.setAlwaysOnTop(true); progress.setLocation((int) loadXML.getLocationOnScreen().getX(), (int) loadXML.getLocationOnScreen().getY()); progress.setUndecorated(true); JProgressBar bar = new JProgressBar(); bar.setIndeterminate(true); progress.add(bar); progress.pack(); progress.setVisible(true); loadConfig(config); progress.dispose(); setEnabledTabs(true); } }.start(); } } catch (Exception e) { e.printStackTrace(); } } }); loadXML.setBounds(670, 20, 120, 20); p8.add(loadXML); // if(!PermissionValidator.canChangeFWM()){ // loadXML.setEnabled(false); // } tdbfile = new JTextField(); addPanel("Database XML path", "File location for database configuration", tdbfile, RunnerRepository.REMOTEDATABASECONFIGPATH + RunnerRepository.REMOTEDATABASECONFIGFILE, 375, true, null); temailfile = new JTextField(); // emailpanel = (JPanel) addPanel("Email XML path", "File location for email configuration", temailfile, RunnerRepository.REMOTEEMAILCONFIGPATH + RunnerRepository.REMOTEEMAILCONFIGFILE, 448, true, null) .getParent(); //paths.remove(emailpanel); // emailpanel.setBounds(360,440,350,100); // RunnerRepository.window.mainpanel.p4.getEmails().add(emailpanel); tglobalsfile = new JTextField(); addPanel("Globals XML file", "File location for globals parameters", tglobalsfile, RunnerRepository.GLOBALSREMOTEFILE, 521, true, null); tceport = new JTextField(); addPanel("Central Engine Port", "Central Engine port", tceport, RunnerRepository.getCentralEnginePort(), 1003, false, null); // traPort = new JTextField(); // addPanel("Resource Allocator Port","Resource Allocator Port", // traPort,RunnerRepository.getResourceAllocatorPort(),808,false,null); // thttpPort = new JTextField(); // addPanel("HTTP Server Port","HTTP Server Port",thttpPort, // RunnerRepository.getHTTPServerPort(),740,false,null); //paths.add(loadXML); if (!PermissionValidator.canChangeFWM()) { ttcpath.setEnabled(false); tMasterXML.setEnabled(false); tUsers.setEnabled(false); tepid.setEnabled(false); tSuites.setEnabled(false); tlog.setEnabled(false); trunning.setEnabled(false); tdebug.setEnabled(false); tsummary.setEnabled(false); tinfo.setEnabled(false); tcli.setEnabled(false); tdbfile.setEnabled(false); temailfile.setEnabled(false); tceport.setEnabled(false); libpath.setEnabled(false); tsecondarylog.setEnabled(false); testconfigpath.setEnabled(false); tglobalsfile.setEnabled(false); logsenabled.setEnabled(false); } }
From source file:be.ac.ua.comp.scarletnebula.gui.windows.GUI.java
private void addToolbar() { final JToolBar toolbar = new JToolBar(); final Icon addIcon = Utils.icon("add16.png"); final JButton addButton = new JButton(addIcon); addButton.addActionListener(new ActionListener() { @Override/*from w w w . jav a 2 s .co m*/ public void actionPerformed(final ActionEvent e) { startAddServerWizard(); } }); addButton.setBounds(10, 10, addIcon.getIconWidth(), addIcon.getIconHeight()); final Icon refreshIcon = Utils.icon("refresh16.png"); final JButton refreshButton = new JButton(refreshIcon); refreshButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { refreshSelectedServers(); } }); refreshButton.setBounds(10, 10, refreshIcon.getIconWidth(), refreshIcon.getIconHeight()); final Icon searchIcon = Utils.icon("search16.png"); final JButton searchButton = new JButton(searchIcon); searchButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { showFilter(); } }); searchButton.setBounds(10, 10, searchIcon.getIconWidth(), searchIcon.getIconHeight()); toolbar.add(addButton); toolbar.add(refreshButton); toolbar.add(searchButton); toolbar.setFloatable(false); add(toolbar, BorderLayout.PAGE_START); }
From source file:com.ln.gui.Notifylist.java
@SuppressWarnings("unchecked") public Notifylist() { setDefaultCloseOperation(DISPOSE_ON_CLOSE); setResizable(false);/*from ww w.j a v a 2 s . co m*/ setIconImage(Toolkit.getDefaultToolkit().getImage(Configuration.mydir + "\\resources\\icons\\ln6464.png")); setTitle("Event list"); DateFormat dd = new SimpleDateFormat("dd"); DateFormat dh = new SimpleDateFormat("HH"); DateFormat dm = new SimpleDateFormat("mm"); Date day = new Date(); Date hour = new Date(); Date minute = new Date(); int dayd = Integer.parseInt(dd.format(day)); int hourh = Integer.parseInt(dh.format(hour)); int minutem = Integer.parseInt(dm.format(minute)); int daydiff = dayd - Main.dayd; int hourdiff = hourh - Main.hourh; int mindiff = minutem - Main.minutem; model.clear(); Events = new String[Main.events]; Events2 = new String[Main.events]; // Events = Main.Eventlist; for (int i = 0; i != Main.events; i++) { Events[i] = Main.Eventlist[i]; } for (int i = 0; i != Main.events; i++) { Events2[i] = Main.Eventlist[i]; } for (int i = 0; i != Events2.length; i++) { if (Events2[i] != null) { Events2[i] = Main.Eventlist[i]; Events2[i] = Events2[i].replace(StringUtils.substringBetween(Events2[i], "in: ", " Days"), Integer .toString(Integer.parseInt(StringUtils.substringBetween(Events2[i], "in: ", " Days")))); Events2[i] = Events2[i].replace(StringUtils.substringBetween(Events2[i], "Days ", " Hours"), Integer .toString(Integer.parseInt(StringUtils.substringBetween(Events2[i], "Days ", " Hours")))); Events2[i] = Events2[i].replace(StringUtils.substringBetween(Events2[i], "Hours ", " Minutes"), Integer.toString( Integer.parseInt(StringUtils.substringBetween(Events2[i], "Hours ", " Minutes")))); } if (Events[i] != null) { Events[i] = Main.Eventlist[i]; Events[i] = Events[i].replace(StringUtils.substringBetween(Events[i], "in: ", " Days"), Integer.toString(Integer.parseInt(StringUtils.substringBetween(Events[i], "in: ", " Days")) - daydiff)); Events[i] = Events[i].replace(StringUtils.substringBetween(Events[i], "Days ", " Hours"), Integer.toString( Integer.parseInt(StringUtils.substringBetween(Events[i], "Days ", " Hours")) - hourdiff)); Events[i] = Events[i].replace(StringUtils.substringBetween(Events[i], "Hours ", " Minutes"), Integer.toString( Integer.parseInt(StringUtils.substringBetween(Events[i], "Hours ", " Minutes")) - mindiff)); //Arrays.sort(Events); model.add(i, Events[i]); } } setBounds(100, 100, 671, 331); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JButton Remove = new JButton("Remove selected"); Remove.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (list.getSelectedIndices().length > 0) { int[] tmp = list.getSelectedIndices(); Main.events = Main.events - tmp.length; int[] selectedIndices = list.getSelectedIndices(); for (int i = tmp.length - 1; i >= 0; i--) { selectedIndices = list.getSelectedIndices(); model.removeElementAt(selectedIndices[i]); Events = ArrayUtils.remove(Events, selectedIndices[i]); Events2 = ArrayUtils.remove(Events2, selectedIndices[i]); Main.Eventlist = ArrayUtils.remove(Main.Eventlist, selectedIndices[i]); //http://i.imgur.com/lN2Fe.jpg } } } }); Remove.setBounds(382, 258, 130, 25); contentPane.add(Remove); JButton btnClose = new JButton("Close"); btnClose.setBounds(522, 258, 130, 25); contentPane.add(btnClose); btnClose.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); try { JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(10, 11, 642, 236); contentPane.add(scrollPane); list.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); list.setBounds(10, 11, 642, 46); scrollPane.setViewportView(list); scrollPane.getVerticalScrollBar().setValue(0); } catch (NullPointerException e) { } }