List of usage examples for javax.swing JLabel setForeground
@BeanProperty(preferred = true, visualUpdate = true, description = "The foreground color of the component.") public void setForeground(Color fg)
From source file:com.polivoto.vistas.AnalistaLocal.java
private void setPreguntasText() { JSONArray js = accionesConsultor.getPreguntas(); for (int i = 0; i < js.length(); i++) { try {/* www . jav a2 s. c o m*/ JPanel panel = new JPanel(new GridBagLayout()); panel.setBackground(new Color(255, 255, 255)); panelPreguntas.add(panel, "Pregunta " + (i + 1)); JLabel lab1 = new JLabel( "Pregunta " + (i + 1) + ": " + ((JSONObject) js.get(i)).getString("pregunta"), JLabel.CENTER); lab1.setFont(new Font("Roboto", 1, 18)); lab1.setForeground(new Color(134, 36, 31)); GridBagConstraints gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 0; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.2; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); panel.add(lab1, gridBagConstraints); JSONArray jarr = ((JSONObject) js.get(i)).getJSONArray("opciones"); for (int j = 0; j < jarr.length(); j++) { JLabel lab2 = new JLabel("Opcin " + (j + 1) + ": " + jarr.getString(j), JLabel.CENTER); lab2.setFont(new Font("Roboto", 1, 15)); lab2.setForeground(new Color(0, 0, 0)); gridBagConstraints = new java.awt.GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = j + 1; gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.1; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); panel.add(lab2, gridBagConstraints); } JPanel panelRelleno = new JPanel(new BorderLayout(20, 20)); panelRelleno.setBackground(Color.white); gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = jarr.length() + 1; gridBagConstraints.fill = GridBagConstraints.BOTH; gridBagConstraints.weightx = 0.1; gridBagConstraints.weighty = 0.9; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); panel.add(panelRelleno, gridBagConstraints); } catch (JSONException ex) { Logger.getLogger(AnalistaLocal.class.getName()).log(Level.SEVERE, null, ex); } } cardsPreguntas.show(panelPreguntas, "Pregunta " + 1); }
From source file:com.diversityarrays.dal.server.AskServerParams.java
public JPanel initGui() { JPanel p = new JPanel(); GBH gbh = new GBH(p, 2, 2, 2, 2); int y = 0;//from w ww. java 2s . c o m gbh.add(0, y, 3, 1, GBH.HORZ, 1, 0, GBH.CENTER, GuiUtil.createLabelSeparator("WWW Root")); ++y; gbh.add(0, y, 1, 1, GBH.NONE, 1, 0, GBH.EAST, "Web root directory:"); gbh.add(1, y, 1, 1, GBH.HORZ, 1, 0, GBH.CENTER, wwwRootPath); gbh.add(2, y, 1, 1, GBH.NONE, 1, 0, GBH.WEST, new JButton(browseWwwRoot)); ++y; // ======================== gbh.add(0, y, 3, 1, GBH.HORZ, 1, 0, GBH.CENTER, GuiUtil.createLabelSeparator("DAL Server")); ++y; gbh.add(0, y, 1, 1, GBH.NONE, 1, 0, GBH.EAST, "DAL Server Hostname:"); gbh.add(1, y, 1, 1, GBH.HORZ, 1, 0, GBH.CENTER, hostnameChoice); gbh.add(2, y, 1, 2, GBH.NONE, 1, 0, GBH.WEST, hostnameInfo); ++y; gbh.add(0, y, 1, 1, GBH.NONE, 1, 0, GBH.EAST, "DAL Server Port:"); gbh.add(1, y, 1, 1, GBH.HORZ, 1, 0, GBH.WEST, dalServerPortSpinner); ++y; gbh.add(0, y, 1, 1, GBH.NONE, 1, 0, GBH.EAST, "Auto Expiry Minutes:"); gbh.add(1, y, 1, 1, GBH.HORZ, 1, 0, GBH.WEST, maxInactiveMinutesSpinner); ++y; gbh.add(0, y, 3, 1, GBH.HORZ, 1, 0, GBH.CENTER, GuiUtil.createLabelSeparator("Select and configure DAL Database:")); ++y; if (factoryTabbedPane.getTabCount() <= 0) { okButton.setEnabled(false); JLabel error = new JLabel( "<HTML>No DalDbProviderService instances are available" + "<BR>Please check your CLASSPATH"); error.setForeground(Color.RED); gbh.add(0, y, 3, 1, GBH.BOTH, 1, 1, GBH.CENTER, error); ++y; } else { gbh.add(0, y, 3, 1, GBH.BOTH, 1, 1, GBH.CENTER, factoryTabbedPane); ++y; } return p; }
From source file:net.mumie.coursecreator.gui.ClassChooser.java
private void buildLayout() { // Dimensions of the Dialog int width = 10; int height = 160; int buttonWidth = 100; int buttonHeight = 30; // sets the Layout this.getContentPane().setLayout(new GridBagLayout()); // the Button and Label Text String okButtonText = "Zuweisen"; String cancelButtonText = "Cancel"; headlineLabelText = ""; // the Fonts/*from ww w .j a v a 2 s .c om*/ Font font = new Font("SansSerif", Font.PLAIN, 14); Font headlineLabelFont = new Font("SansSerif", Font.PLAIN, 12); Font textFieldFont = new Font("Monospaced", Font.PLAIN, 10); // GridBagContraints for rootPanel (s.b.): GridBagConstraints rootPanelStyle = createGridBagContrains(GridBagConstraints.CENTER, 4, 4, 4, 4, 0, 0); // GridBagContraints for headlineLabel: GridBagConstraints headlineLabelStyle = createGridBagContrains(GridBagConstraints.CENTER, 6, 6, 6, 6, 0, 0); // GridBagConstraints for textFieldPanel (s.b.): GridBagConstraints textFieldPanelStyle = createGridBagContrains(GridBagConstraints.CENTER, 4, 4, 4, 4, 0, 1); // GridBagConstraints for buttonPanel (s.b.): GridBagConstraints buttonPanelStyle = createGridBagContrains(GridBagConstraints.CENTER, 4, 4, 4, 4, 0, 2); // GridBagConstraints for serverTextField: GridBagConstraints serverTextFieldStyle = createGridBagContrains(GridBagConstraints.WEST, 6, 6, 6, 6, 1, 0); // GridBagContraints for okButton (s.b.): GridBagConstraints okButtonStyle = createGridBagContrains(GridBagConstraints.CENTER, 6, 6, 6, 6, 0, 0); // GridBagContraints for cancelButton (s.b.): GridBagConstraints cancelButtonStyle = createGridBagContrains(GridBagConstraints.CENTER, 6, 6, 6, 6, 1, 0); // Creating rootPanel (contains all components) JPanel rootPanel = new JPanel(new GridBagLayout()); rootPanel.setFont(font); // Creating headlineLabel: JLabel headlineLabel = new JLabel(headlineLabelText); headlineLabel.setFont(headlineLabelFont); // Creating textFieldPanel: JPanel textFieldPanel = new JPanel(new GridBagLayout()); textFieldPanel.setFont(font); // Creating classTextField: classBox = new JComboBox(this.classList); classBox.setFont(textFieldFont); String classPath = this.controller.getMetaInfoField().getMetaInfos().getClassPath(); String className = this.controller.getMetaInfoField().getMetaInfos().getClassName(); if (setSelectedClass(classPath, className) == -1) headlineLabel.setForeground(Color.RED); else headlineLabel.setForeground(Color.BLACK); headlineLabel.setText(this.headlineLabelText); // Creating buttonPanel: JPanel buttonPanel = new JPanel(new GridBagLayout()); buttonPanel.setFont(font); // okButton: JButton okButton = new JButton(okButtonText); okButton.setPreferredSize(new Dimension(buttonWidth, buttonHeight)); okButton.setActionCommand(CommandConstants.META_INFO_FIELD_OK); okButton.addActionListener(this.controller); // cancelButton: JButton cancelButton = new JButton(cancelButtonText); cancelButton.setPreferredSize(new Dimension(buttonWidth, buttonHeight)); cancelButton.setActionCommand(CommandConstants.META_INFO_FIELD_CANCEL); cancelButton.addActionListener(this.controller); // Composing the GUI: this.getContentPane().setLayout(new GridBagLayout()); this.getContentPane().add(rootPanel, rootPanelStyle); rootPanel.add(headlineLabel, headlineLabelStyle); rootPanel.add(textFieldPanel, textFieldPanelStyle); textFieldPanel.add(classBox, serverTextFieldStyle); rootPanel.add(buttonPanel, buttonPanelStyle); buttonPanel.add(okButton, okButtonStyle); buttonPanel.add(cancelButton, cancelButtonStyle); this.addWindowListener(this.windowListener); int maxString = this.headlineLabelText.length(); for (int i = 0; i < this.classList.size(); i++) { maxString = Math.max(((String) this.classList.get(i).toString()).length(), maxString); } width = Math.max(width, maxString * 8); this.setSize(width, height); }
From source file:com.isencia.passerelle.hmi.generic.GenericHMI.java
private JPanel createTitlePanel(final String name) { final JPanel result = new JPanel(new BorderLayout()); final ImageIcon icon = new ImageIcon(Toolkit.getDefaultToolkit() .getImage(getClass().getResource("/com/isencia/passerelle/hmi/resources/param.gif"))); final JLabel startLabel = new JLabel(icon); result.add(startLabel, BorderLayout.LINE_START); final JLabel nameLabel = new JLabel(name); final Font f = nameLabel.getFont(); nameLabel.setFont(new Font(f.getName(), f.getStyle(), f.getSize() + 2)); nameLabel.setForeground(new Color(49, 106, 196)); result.add(nameLabel);/* ww w. ja va 2 s .com*/ return result; }
From source file:com.lottery.gui.MainLotteryForm.java
private void btnAddNumberActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddNumberActionPerformed try {/* www . j av a 2s . c o m*/ Integer number = Integer.parseInt(inputNumberTf.getText()); if (inputNumbers.contains(number)) { JOptionPane.showMessageDialog(this, "Number has already existed!"); return; } if (number > LotteryUtils.MAX_BALL_VALUE || number < LotteryUtils.MIN_BALL_VALUE) { JOptionPane.showMessageDialog(this, "Invalid range (" + LotteryUtils.MIN_BALL_VALUE + " - " + LotteryUtils.MAX_BALL_VALUE + ")!"); return; } JLabel numberLbl = new JLabel(number + ""); numberLbl.setOpaque(true); //numberLbl.setMinimumSize(new Dimension(100, 100)); // numberLbl.setPreferredSize(new Dimension(400, 100)); // numberLbl.setBackground(Color.white); numberLbl.setForeground(Color.red); setFont(numberLbl.getFont().deriveFont(150f)); numberLbl.setFont(new Font("Serif", Font.PLAIN, 30)); int numberOfInput = inputNumbers.size(); int row = numberOfInput / NO_NUMBER_PER_ROW; int col = numberOfInput % NO_NUMBER_PER_ROW; c.fill = GridBagConstraints.HORIZONTAL; c.gridx = col; c.gridy = row; c.weightx = 0.5; ballNumbersPanel.add(numberLbl, c); lbNumbers.add(numberLbl); inputNumbers.add(number); ballNumbersPanel.revalidate(); ballNumbersPanel.repaint(); inputNumberTf.setText(""); inputNumberTf.requestFocusInWindow(); // // check if has winner // Date today = LotteryUtils.getNextDate(new Date()); // if (dbTicketTables.isEmpty()) { // dbTicketTables = ticketTableService.getByDate(today); // } totalDrawedNumbers++; checkCanAddNumber(); if (inputNumbers.size() < LotteryUtils.MAX_BALLS_PER_LINE) { return; } winTicketTables.addAll(LotteryUtils.getWinnerByLine(dbTicketTables, inputNumbers)); if (winTicketTables.size() > 0) { // update table list view refreshWinnerTable(); // JOptionPane.showMessageDialog(this, "Number of winner: " + winTicketTables.size()); } // check if has full table, then stop game if (totalDrawedNumbers >= (LotteryUtils.MAX_BALLS_PER_LINE * LotteryUtils.NO_LINES_PER_TABLE)) { Iterator<TicketTable> iter = winTicketTables.iterator(); while (iter.hasNext()) { TicketTable tmp = iter.next(); if (tmp.getWinType() == TicketTable.FULL_TABLE) { JOptionPane.showMessageDialog(this, "Got winner with full table!"); // save draw results, update ticket_table winner DrawResult drawResult = new DrawResult(); drawResult.setDrawDate(LotteryUtils.getDate(ftfDrawDate.getText().trim())); drawResult.setDrawBalls(StringUtils.join(inputNumbers, LotteryUtils.BALLS_SEPARATOR)); drawResult.setRound(Byte.parseByte((String) cbbRound.getSelectedItem())); drawResultService.updateWinner(drawResult, winTicketTables); restartGame(); return; } } } } catch (NumberFormatException ex) { LOGGER.error("Invalid number!: ", ex); JOptionPane.showMessageDialog(this, "Invalid number!"); } catch (ParseException ex) { LOGGER.error("Cant parse date", ex); JOptionPane.showMessageDialog(this, "Cant save result!"); } }
From source file:com.isencia.passerelle.hmi.generic.GenericHMI.java
private JPanel createCompositePanel(final JPanel b, final JComponent c, final String name) { final JPanel compositeBox = new JPanel(new VerticalLayout(5)); int r = b.getBackground().getRed() - 20; if (r < 1) { r = 0;//w w w .jav a 2s . c om } if (r > 254) { r = 255; } int g = b.getBackground().getGreen() - 20; if (g < 1) { g = 0; } if (g > 254) { g = 255; } int bl = b.getBackground().getBlue() - 20; if (bl < 1) { bl = 0; } if (bl > 254) { bl = 255; } compositeBox.setBackground(new Color(r, g, bl)); final JPanel title = new JPanel(new BorderLayout()); title.setBackground(new Color(r, g, bl)); /* * ImageIcon icon = new ImageIcon( Toolkit .getDefaultToolkit() * .getImage( (getClass() * .getResource("/com/isencia/passerelle/hmi/resources/composite.gif" * )))); JLabel lab = new JLabel(icon); * * title.add(lab, BorderLayout.LINE_START); */ final JLabel lab2 = new JLabel(name); final Font f = lab2.getFont(); lab2.setFont(new Font(f.getName(), f.getStyle(), f.getSize() + 6)); lab2.setForeground(new Color(49, 106, 196)); title.add(lab2); compositeBox.add(title); final Border loweredbevel = BorderFactory.createLoweredBevelBorder(); final TitledBorder border = BorderFactory.createTitledBorder(loweredbevel); compositeBox.setBorder(border); compositeBox.setName(name); c.setBackground(new Color(r, g, bl)); compositeBox.add(c); return compositeBox; }
From source file:org.forester.archaeopteryx.ControlPanel.java
static JLabel customizeLabel(final JLabel label, final Configuration configuration) { label.setFont(ControlPanel.jcb_bold_font); if (!configuration.isUseNativeUI()) { label.setForeground(ControlPanel.jcb_text_color); label.setBackground(ControlPanel.background_color); }// w w w.j ava2 s . c o m return label; }
From source file:org.pentaho.support.standalone.SDSupportUtility.java
/** * initializing UI//from w w w .j a v a 2s .c o m * * @throws Exception */ public SDSupportUtility() throws Exception { prop = loadProperty(); setResizable(false); setTitle(SDConstant.PENT_SUP_WIZARD); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 665, 516); contentPane = new JPanel(); contentPane.setBackground(UIManager.getColor("Button.background")); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JLabel lblLastAttached = new JLabel("Last Attached"); lblLastAttached.setOpaque(false); lblLastAttached.setHorizontalAlignment(SwingConstants.LEFT); lblLastAttached.setBounds(322, 335, 127, 23); contentPane.add(lblLastAttached); JLabel lblPentahoCustomerSupport = new JLabel("Pentaho Customer Support Wizard"); lblPentahoCustomerSupport.setForeground(new Color(51, 51, 51)); lblPentahoCustomerSupport.setVerticalAlignment(SwingConstants.TOP); lblPentahoCustomerSupport.setHorizontalAlignment(SwingConstants.RIGHT); lblPentahoCustomerSupport.setFont(new Font("Tahoma", Font.BOLD, 23)); lblPentahoCustomerSupport.setBounds(130, 109, 506, 37); contentPane.add(lblPentahoCustomerSupport); JLabel lbllogo = new JLabel(); lbllogo.setIcon(new ImageIcon( SDSupportUtility.class.getResource("/org/pentaho/support/standalone/puc-login-logo.png"))); lbllogo.setBounds(10, 11, 409, 93); contentPane.add(lbllogo); chckbxNewCheckBoxEnvironment = new JCheckBox("Environment"); chckbxNewCheckBoxEnvironment.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.ENVIRONMENT); } else { ArgList.remove(SDConstant.ENVIRONMENT); } } }); chckbxNewCheckBoxEnvironment.setBounds(109, 268, 243, 23); contentPane.add(chckbxNewCheckBoxEnvironment); chckbxNewCheckBoxEnvironment.setOpaque(false); chckbxNewCheckBoxStructure = new JCheckBox("Structure Details"); chckbxNewCheckBoxStructure.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.STRUCT); } else { ArgList.remove(SDConstant.STRUCT); } } }); chckbxNewCheckBoxStructure.setBounds(377, 190, 248, 23); contentPane.add(chckbxNewCheckBoxStructure); chckbxNewCheckBoxStructure.setOpaque(false); chckbxLogs = new JCheckBox("Logs"); chckbxLogs.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.LOGS); } else { ArgList.remove(SDConstant.LOGS); } } }); chckbxLogs.setBounds(377, 164, 248, 23); contentPane.add(chckbxLogs); chckbxLogs.setOpaque(false); chckbxGetSecureFiles = new JCheckBox("Secure Files"); chckbxGetSecureFiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.SECURITY); } else { ArgList.remove(SDConstant.SECURITY); } } }); chckbxGetSecureFiles.setBounds(109, 190, 243, 23); contentPane.add(chckbxGetSecureFiles); chckbxGetSecureFiles.setOpaque(false); chckbxMd5 = new JCheckBox("MD5 Hash Value"); chckbxMd5.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.MD5); } else { ArgList.remove(SDConstant.MD5); } } }); chckbxMd5.setBounds(109, 216, 243, 23); contentPane.add(chckbxMd5); chckbxMd5.setOpaque(false); chckbxDbdetails = new JCheckBox("Datasource Details"); chckbxDbdetails.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.DATASOURCE); } else { ArgList.remove(SDConstant.DATASOURCE); } } }); chckbxDbdetails.setBounds(109, 294, 243, 23); contentPane.add(chckbxDbdetails); chckbxDbdetails.setOpaque(false); chckbxLicense = new JCheckBox("License File"); chckbxLicense.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.LICENSE); } else { ArgList.remove(SDConstant.LICENSE); } } }); chckbxLicense.setBounds(109, 164, 243, 23); contentPane.add(chckbxLicense); chckbxLicense.setOpaque(false); chckbxProcesslist = new JCheckBox("Running Process"); chckbxProcesslist.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.RUNNING_TASK); } else { ArgList.remove(SDConstant.RUNNING_TASK); } } }); chckbxProcesslist.setBounds(109, 242, 243, 23); contentPane.add(chckbxProcesslist); chckbxProcesslist.setOpaque(false); chckbxTomcatxml = new JCheckBox("XML files from Tomcat"); chckbxTomcatxml.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); tomcatXml = true; } else { ArgList.remove(SDConstant.FILE); tomcatXml = false; } } }); chckbxTomcatxml.setBounds(377, 242, 248, 23); contentPane.add(chckbxTomcatxml); chckbxTomcatxml.setOpaque(false); chckbxServerXml = new JCheckBox("XML files from Server"); chckbxServerXml.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverXml = true; } else { ArgList.remove(SDConstant.FILE); serverXml = false; } } }); chckbxServerXml.setBounds(377, 216, 248, 23); contentPane.add(chckbxServerXml); chckbxServerXml.setOpaque(false); chckbxGetBatfiles = new JCheckBox("Start up files from server"); chckbxGetBatfiles.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverBatFile = true; } else { ArgList.remove(SDConstant.FILE); serverBatFile = false; } } }); chckbxGetBatfiles.setBounds(377, 268, 248, 23); contentPane.add(chckbxGetBatfiles); chckbxGetBatfiles.setOpaque(false); chckbxServerproperties = new JCheckBox("Properites files from server"); chckbxServerproperties.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { ArgList.add(SDConstant.FILE); serverProrperties = true; } else { ArgList.remove(SDConstant.FILE); serverProrperties = false; } } }); chckbxServerproperties.setBounds(377, 294, 248, 23); contentPane.add(chckbxServerproperties); chckbxServerproperties.setOpaque(false); btnNewButton = new JButton("Package"); btnNewButton.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { try { if (installType.equalsIgnoreCase("Manual")) { if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error", JOptionPane.ERROR_MESSAGE); } else { WEB_XML = new StringBuilder(); WEB_XML.append(prop.getProperty(SDConstant.BI_TOM_PATH)).append(File.separator) .append(SDConstant.WEB_APP).append(File.separator).append(SDConstant.PENTAHO) .append(File.separator).append(SDConstant.WEB_INF).append(File.separator) .append(SDConstant.WEB_XML); PENTAHO_SOLU_PATH = getSolutionPath("biserver", WEB_XML.toString()); prop.put(SDConstant.PENTAHO_SOLU_PATH, PENTAHO_SOLU_PATH); prop.put(SDConstant.BI_PATH, PENTAHO_SOLU_PATH); } } if (prop.getProperty(SDConstant.BI_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_1, "Inane error", JOptionPane.ERROR_MESSAGE); } if (prop.getProperty(SDConstant.BI_TOM_PATH) == null) { JOptionPane.showMessageDialog(contentPane, SDConstant.ERROR_12, "Inane error", JOptionPane.ERROR_MESSAGE); } disableAll(); setBIServerPath(prop); final String data = textFieldBrowser.getText(); if (!data.equalsIgnoreCase(null)) { ArgList.add(SDConstant.BROWSER); } String[] array = new String[ArgList.size()]; int count = 0; for (int i = 0; i < ArgList.size(); i++) { String retName = ArgList.get(i); if (retName.equals("file")) { if (count == 0) { array[i] = retName; count++; } } else { array[i] = retName; } } ApplicationContext context = new ClassPathXmlApplicationContext(SDConstant.SPRNG_FILE_NAME); factory = (CofingRetrieverFactory) context.getBean("cofingRetrieverFactory"); ConfigRetreiver[] config = factory.getConfigRetrevier(array); ExecutorService service = Executors.newFixedThreadPool(10); for (final ConfigRetreiver configobj : config) { if (null != configobj) { configobj.setBISeverPath(prop); configobj.setServerName("biserver"); if (installType.equalsIgnoreCase("Installer")) { configobj.setInstallType("Installer"); } else if (installType.equalsIgnoreCase("Archive")) { configobj.setInstallType("Archive"); } else if (installType.equalsIgnoreCase("Manual")) { configobj.setInstallType("Manual"); } if (configobj instanceof FileRetriever) { configobj.setBidiXml(serverXml); configobj.setBidiBatFile(serverBatFile); configobj.setBidiProrperties(serverProrperties); configobj.setTomcatXml(tomcatXml); } if (configobj instanceof BrowserInfoRetriever) { configobj.setBrowserInfo(data); } service.execute(new Runnable() { public void run() { if (null != configobj) configobj.readAndSaveConfiguration(prop); } }); } } btnNewButton.setVisible(false); progressBar.setVisible(true); ProgressThread thread = new ProgressThread(); thread.setSupport(getSupport()); thread.setProp(prop); new Thread(thread).start(); service.shutdown(); } catch (Exception e1) { e1.printStackTrace(); } } }); chckbxSelectAll = new JCheckBox("Select/ De-select"); chckbxSelectAll.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { selectAll(); } else { deSelectAll(); } } }); chckbxSelectAll.setBounds(46, 138, 201, 23); chckbxSelectAll.setOpaque(false); contentPane.add(chckbxSelectAll); btnNewButton.setForeground(SystemColor.infoText); btnNewButton.setBounds(10, 430, 639, 37); contentPane.add(btnNewButton); chckbxServerproperties.setOpaque(false); JLabel lblAttach = new JLabel("Attach Artifact"); lblAttach.setHorizontalAlignment(SwingConstants.LEFT); lblAttach.setBounds(32, 335, 177, 23); contentPane.add(lblAttach); lblAttach.setOpaque(false); JButton btnNewButtonBrowse = new JButton("Browse"); btnNewButtonBrowse.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { saveSelectedFile(prop); JFrame parentFrame = new JFrame(); JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Specify a file to save"); fileChooser.setMultiSelectionEnabled(true); int userSelection = fileChooser.showSaveDialog(parentFrame); if (userSelection == JFileChooser.APPROVE_OPTION) { fileToSave = fileChooser.getSelectedFiles(); for (int i = 0; i < fileToSave.length; i++) { File file = fileToSave[i]; String artifactpath = file.getAbsolutePath(); File f = new File(artifactpath); String absolutefilename = f.getName(); String filename = ArtifactsDirectory.concat(absolutefilename); CopyFile artifactcopy = new CopyFile(artifactpath, filename); try { artifactcopy.copy(); } catch (Exception e1) { e1.printStackTrace(); } } uploadedFiles(); rowList = new JList(model); listScrollPane.setViewportView(rowList); panel.add(listScrollPane); } rowList.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { lblDelete.setVisible(true); } }); } }); btnNewButtonBrowse.setBounds(208, 335, 104, 23); contentPane.add(btnNewButtonBrowse); btnNewButtonBrowse.setOpaque(false); textFieldBrowser = new JTextField(); textFieldBrowser.setBounds(208, 364, 441, 23); contentPane.add(textFieldBrowser); textFieldBrowser.setColumns(10); progressBar = new JProgressBar(0, 100); progressBar.setBounds(8, 437, 639, 24); progressBar.setVisible(false); progressBar.setStringPainted(true); contentPane.add(progressBar); JLabel lblBrowserInformation = new JLabel("Browser Information"); lblBrowserInformation.setHorizontalAlignment(SwingConstants.LEFT); lblBrowserInformation.setLabelFor(textFieldBrowser); lblBrowserInformation.setBounds(32, 368, 174, 14); contentPane.add(lblBrowserInformation); panel = new JPanel(); panel.setBounds(423, 325, 127, 33); contentPane.add(panel); panel.setLayout(null); listScrollPane = new JScrollPane(); listScrollPane.setBounds(0, 0, 127, 33); panel.add(listScrollPane); lblDelete = new JLabel(""); lblDelete.setBounds(552, 325, 22, 23); lblDelete.setVisible(false); lblDelete.setIcon( new ImageIcon(SDSupportUtility.class.getResource("/org/pentaho/support/standalone/remove.png"))); contentPane.add(lblDelete); lblDelete.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int option = JOptionPane.showConfirmDialog(null, "Are you sure you want to delete this file ?"); if (option == JOptionPane.YES_OPTION) { String sel = rowList.getSelectedValue().toString(); String selected = dir + "/" + sel; File fileExists = new File(selected); fileExists.delete(); model.remove(sel.indexOf(sel)); lblDelete.setVisible(false); } } }); JLabel instalType = new JLabel("Installation Type : "); instalType.setBounds(32, 395, 177, 23); instalType.setVisible(true); contentPane.add(instalType); ButtonGroup btnGrp = new ButtonGroup(); rdbtnInstaller = new JRadioButton("Installer"); rdbtnInstaller.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Installer"; } }); rdbtnInstaller.setBounds(208, 395, 104, 23); rdbtnInstaller.setSelected(true); contentPane.add(rdbtnInstaller); btnGrp.add(rdbtnInstaller); rdbtnArchive = new JRadioButton("Archive"); rdbtnArchive.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Archive"; } }); rdbtnArchive.setBounds(333, 395, 104, 23); contentPane.add(rdbtnArchive); btnGrp.add(rdbtnArchive); rdbtnManual = new JRadioButton("Manual"); rdbtnManual.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { installType = "Manual"; } }); rdbtnManual.setBounds(460, 395, 127, 27); contentPane.add(rdbtnManual); btnGrp.add(rdbtnManual); JLabel lblBackground = new JLabel(); lblBackground.setIcon(new ImageIcon( SDSupportUtility.class.getResource("/org/pentaho/support/standalone/login-crystal-bg.jpg"))); lblBackground.setBackground(SystemColor.controlHighlight); lblBackground.setHorizontalAlignment(SwingConstants.CENTER); lblBackground.setBounds(0, 0, 659, 488); contentPane.add(lblBackground); }
From source file:Interfaz.rubiktimer.java
private void cargarArchivoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cargarArchivoActionPerformed // TODO add your handling code here: if (listaT.primero == null) { JOptionPane.showMessageDialog(null, "El archivo a cargar debe ser un archivo que se guardo en la Opcion (Guardar Datos Para Cargar) y no de la opcion (Guardar Datos Para Usuario), si se intenta cargar un archivo de usuario no se cargara ningun dato", "Informacin", JOptionPane.INFORMATION_MESSAGE); CargarDat ventanaVisualizar = new CargarDat(); ventanaVisualizar.cargArchivo(listaT, lista5mej, lista10mej); actualizar_estad();/* ww w .ja va2 s . c o m*/ Lista nueva = new Lista(); nueva = listaT; Nodo actual; actual = nueva.primero; while ((actual != null)) { JLabel nuevo_tiempo = new JLabel(actual.getDato_string()); nuevo_tiempo.setFont(new java.awt.Font("Lucida Sans", 0, 25)); nuevo_tiempo.setForeground(Color.yellow); JButton eliminar = new JButton("Eliminar Tiempo"); eliminar.setFocusable(false); JButton Penalizacion = new JButton("Penalizacion +2"); Penalizacion.setFocusable(false); JButton DNF = new JButton("DNF"); DNF.setFocusable(false); /*if (tipoCubScramble == 0) { Scramble_parametro = Scramble; } else { Scramble_parametro = Scramble4x4; }*/ JLabel nuevo_Scramble = new JLabel(actual.getScramble()); nuevo_Scramble.setFont(new java.awt.Font("Lucida Sans", 0, 15)); nuevo_Scramble.setForeground(Color.white); panel.add(nuevo_tiempo); panel.add(nuevo_Scramble); panel.add(eliminar); panel.add(Penalizacion); panel.add(DNF); panel.updateUI(); funcionalidad_botones(nuevo_tiempo, nuevo_Scramble, eliminar, Penalizacion, DNF); actual = actual.enlace; } actualizarGrafica(); System.out.println("LISTAAAAAAAAA LOOOOOOL "); System.out.println(listaT.primero.getDato_string()); } else { JOptionPane.showMessageDialog(null, "No puede guardar en un documento una Sesion VACIA", "Sesion Vacia", JOptionPane.INFORMATION_MESSAGE); } }
From source file:Interfaz.rubiktimer.java
@Override public void keyPressed(KeyEvent ke) { System.out.println("Pulsado"); if (verifi != 0) { if (ke.getKeyCode() == KeyEvent.VK_SPACE) { switch (verificador) { case 1: // COMIENZA SOLVE t_atras.stop();/* w w w . j a v a 2s .c o m*/ t.start(); actualizarLabel(); verificador = 2; break; case 0: // CONTEO ATRAS t_atras.start(); actualizarLabel_atras(); verificador = 1; break; case 2: // DETENER SOLVE t.stop(); segundos_atras = aux; minutos = 0.00; if (m > 0) { minutos = 60 * (double) m; } cent_seg = (double) cs / 100; tiempo = (double) s + cent_seg + minutos; String tiempo_str = (m <= 9 ? "0" : "") + m + ":" + (s <= 9 ? "0" : "") + s + "." + (cs <= 9 ? "0" : "") + cs; JLabel nuevo_tiempo = new JLabel(tiempo_str); nuevo_tiempo.setFont(new java.awt.Font("Lucida Sans", 0, 25)); nuevo_tiempo.setForeground(Color.yellow); JButton eliminar = new JButton("Eliminar Tiempo"); eliminar.setFocusable(false); JButton Penalizacion = new JButton("Penalizacion +2"); Penalizacion.setFocusable(false); JButton DNF = new JButton("DNF"); DNF.setFocusable(false); if (tipoCubScramble == 0) { Scramble_parametro = Scramble; } else { Scramble_parametro = Scramble4x4; } JLabel nuevo_Scramble = new JLabel(Scramble_parametro); nuevo_Scramble.setFont(new java.awt.Font("Lucida Sans", 0, 15)); nuevo_Scramble.setForeground(Color.white); panel.add(nuevo_tiempo); panel.add(nuevo_Scramble); panel.add(eliminar); panel.add(Penalizacion); panel.add(DNF); panel.updateUI(); listaT.insertarCabezaLista(tiempo, tiempo_str, Scramble_parametro); //lista todos los solves lista5mej.insertarNUMmejores(5, lista5mej, tiempo, nuevo_tiempo, tiempo_str, Scramble_parametro); //lista 5 mejores lista10mej.insertarNUMmejores(10, lista10mej, tiempo, nuevo_tiempo, tiempo_str, Scramble_parametro); // lista 10 mejores actualizarGrafica(); funcionalidad_botones(nuevo_tiempo, nuevo_Scramble, eliminar, Penalizacion, DNF); System.out.println("\tLista Generada 3x3"); listaT3x3.visualizar(); System.out.println("\tLista Generada 4x4"); listaT4x4.visualizar(); System.out.println("\tLista Generada 2x2"); listaT2x2.visualizar(); System.out.println("\tLista 5 mejores"); lista5mej.visualizar(); System.out.println("\tLista 10 mejores"); lista10mej.visualizar(); actualizar_estad(); verificador = 0; m = 0; s = 0; cs = 0; //actualizarLabel(); if (tipoCubScramble == 0) { actualizarScramble(); } else { actualizarScramble4x4(); } actualizar_estad(); actualizarGrafica(); verificador = 0; break; default: break; } } } else { JOptionPane.showMessageDialog(null, "Primero se tiene que escoger una categoria de cubo", "Escoger una Categoria", JOptionPane.INFORMATION_MESSAGE); } }