List of usage examples for javax.swing JLabel setOpaque
@BeanProperty(expert = true, description = "The component's opacity") public void setOpaque(boolean isOpaque)
From source file:org.isatools.isacreatorconfigurator.configui.DataEntryPanel.java
private void createMainSector() { JPanel topContainer = new JPanel(); topContainer.setLayout(new BoxLayout(topContainer, BoxLayout.PAGE_AXIS)); topContainer.setBackground(UIHelper.BG_COLOR); // add logo to the top topContainer.add(createMenu());// ww w . java 2 s .com JPanel headerImagePanel = new JPanel(new GridLayout(1, 2)); headerImagePanel.setOpaque(false); JLabel logo = new JLabel(""); logo.setOpaque(false); headerImagePanel.add(logo); tableInformationDisplay = UIHelper.createLabel("", UIHelper.VER_12_PLAIN, UIHelper.DARK_GREEN_COLOR, SwingConstants.RIGHT); tableInformationDisplay.setVerticalAlignment(SwingConstants.TOP); tableInformationDisplay.setHorizontalAlignment(SwingConstants.RIGHT); headerImagePanel.add(UIHelper.wrapComponentInPanel(tableInformationDisplay)); topContainer.add(headerImagePanel); topContainer.add(Box.createVerticalStrut(10)); add(topContainer, BorderLayout.NORTH); // create central console with majority of content! createNavigationPanel(); JPanel bottomContainer = new JPanel(); bottomContainer.setLayout(new BoxLayout(bottomContainer, BoxLayout.PAGE_AXIS)); bottomContainer.setBackground(UIHelper.BG_COLOR); add(bottomContainer, BorderLayout.SOUTH); }
From source file:org.isatools.isacreatorconfigurator.configui.DataEntryPanel.java
private JPanel createTableListPanel() { JPanel container = new JPanel(); container.setBackground(UIHelper.BG_COLOR); container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); JLabel lab = new JLabel(tableListTitle); container.add(UIHelper.wrapComponentInPanel(lab)); container.add(Box.createVerticalStrut(5)); tableModel = new DefaultListModel(); tableList = new JList(tableModel); tableList.setCellRenderer(new TableListRenderer()); tableList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION); tableList.setBackground(UIHelper.BG_COLOR); tableList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { try { saveCurrentField(false, false); } catch (DataNotCompleteException dce) { showMessagePane(dce.getMessage(), JOptionPane.ERROR_MESSAGE); }/*from w w w . j a v a 2 s. c o m*/ MappingObject currentlyEditedTable = getCurrentlySelectedTable(); ApplicationManager.setCurrentMappingObject(currentlyEditedTable); // update the view error button visibility depending on selected tables error state. viewErrorsButton.setVisible(areThereErrorsInThisCurrentObject()); updateTableInfoDisplay(currentlyEditedTable); reformFieldList(currentlyEditedTable); } }); JScrollPane listScroller = new JScrollPane(tableList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); listScroller.getViewport().setBackground(UIHelper.BG_COLOR); listScroller.setBorder(null); listScroller.setPreferredSize(new Dimension(((int) (WIDTH * 0.25)), ((int) (HEIGHT * 0.75)))); IAppWidgetFactory.makeIAppScrollPane(listScroller); container.add(listScroller); container.add(Box.createVerticalStrut(5)); tableCountInfo = UIHelper.createLabel("", UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR); container.add(UIHelper.wrapComponentInPanel(tableCountInfo)); container.add(Box.createVerticalStrut(5)); // create button panel to add and remove tables JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS)); buttonPanel.setBackground(UIHelper.BG_COLOR); final JLabel addTableButton = new JLabel(addTable, JLabel.LEFT); UIHelper.renderComponent(addTableButton, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false); addTableButton.setOpaque(false); addTableButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent mouseEvent) { addTableButton.setIcon(addTableOver); } @Override public void mouseExited(MouseEvent mouseEvent) { addTableButton.setIcon(addTable); } public void mousePressed(MouseEvent event) { SwingUtilities.invokeLater(new Runnable() { public void run() { addTableButton.setIcon(addTable); applicationContainer.showJDialogAsSheet(addTableUI); } }); } }); addTableButton.setToolTipText("<html><b>Add table</b><p>Add a new table definition.</p></html>"); final JLabel removeTableButton = new JLabel(removeTable, JLabel.LEFT); UIHelper.renderComponent(removeTableButton, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false); removeTableButton.setOpaque(false); removeTableButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent mouseEvent) { removeTableButton.setIcon(removeTableOver); } @Override public void mouseExited(MouseEvent mouseEvent) { removeTableButton.setIcon(removeTable); } public void mousePressed(MouseEvent event) { removeTableButton.setIcon(removeTable); if (tableList.getSelectedValue() != null) { String selectedTable = tableList.getSelectedValue().toString(); MappingObject toRemove = null; for (MappingObject mo : tableFields.keySet()) { if (mo.getAssayName().equals(selectedTable)) { toRemove = mo; break; } } if (toRemove != null) { tableFields.remove(toRemove); reformTableList(); } } } }); removeTableButton.setToolTipText("<html><b>Remove table</b><p>Remove table from definitions?</p></html>"); viewErrorsButton = new JLabel(viewErrorsIcon); viewErrorsButton.setVisible(false); viewErrorsButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent mouseEvent) { viewErrorsButton.setIcon(viewErrorsIcon); // show error pane for current table only. Validator validator = new Validator(); validateFormOrTable(validator, ApplicationManager.getCurrentMappingObject()); ValidationReport report = validator.getReport(); ConfigurationValidationUI validationUI = new ConfigurationValidationUI(tableFields.keySet(), report); validationUI.createGUI(); validationUI.setLocationRelativeTo(getApplicationContainer()); validationUI.setAlwaysOnTop(true); validationUI.setVisible(true); } @Override public void mouseEntered(MouseEvent mouseEvent) { viewErrorsButton.setIcon(viewErrorsIconOver); } @Override public void mouseExited(MouseEvent mouseEvent) { viewErrorsButton.setIcon(viewErrorsIcon); } }); buttonPanel.add(addTableButton); buttonPanel.add(removeTableButton); buttonPanel.add(viewErrorsButton); buttonPanel.add(Box.createHorizontalGlue()); container.add(buttonPanel); container.add(Box.createVerticalGlue()); return container; }
From source file:org.isatools.isacreatorconfigurator.configui.DataEntryPanel.java
private JPanel createFieldListPanel() { JPanel container = new JPanel(); container.setBackground(UIHelper.BG_COLOR); container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); JPanel headerLab = new JPanel(new GridLayout(1, 1)); headerLab.setOpaque(false);/*from w w w . j a va 2s . com*/ JLabel lab = new JLabel(fieldListTitle); headerLab.add(lab); container.add(headerLab); container.add(Box.createVerticalStrut(5)); elementModel = new DefaultListModel(); elementList = new ReOrderableJList(elementModel); elementList.setCellRenderer(new CustomReOrderableListCellRenderer(elementList)); elementList.setDragEnabled(true); elementList.setBackground(UIHelper.BG_COLOR); elementList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent event) { Display selectedNode = (Display) elementList.getSelectedValue(); if (selectedNode != null) { try { saveCurrentField(false, false); } catch (DataNotCompleteException dce) { showMessagePane(dce.getMessage(), JOptionPane.ERROR_MESSAGE); } if (selectedNode instanceof FieldElement) { fieldInterface.setCurrentField((FieldElement) selectedNode); if (currentPage != fieldInterface) { setCurrentPage(fieldInterface); } removeElementButton.setEnabled(!standardISAFields.isFieldRequired(selectedNode.toString())); } else { setCurrentPage(structureElement); } } } }); elementList.addPropertyChangeListener("orderChanged", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { updateFieldOrder(); if (tableList.getSelectedValue() instanceof MappingObject) { validateFormOrTable(ApplicationManager.getCurrentMappingObject()); } } }); JScrollPane listScroller = new JScrollPane(elementList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); listScroller.getViewport().setBackground(UIHelper.BG_COLOR); listScroller.setBorder(new EmptyBorder(2, 2, 2, 10)); listScroller.setPreferredSize(new Dimension(((int) (WIDTH * 0.25)), ((int) (HEIGHT * 0.75)))); IAppWidgetFactory.makeIAppScrollPane(listScroller); container.add(listScroller); container.add(Box.createVerticalStrut(5)); elementCountInfo = UIHelper.createLabel("", UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR); container.add(UIHelper.wrapComponentInPanel(elementCountInfo)); container.add(Box.createVerticalStrut(5)); // create button panel to add and remove tables JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.LINE_AXIS)); buttonPanel.setBackground(UIHelper.BG_COLOR); final JLabel addFieldButton = new JLabel(addElement, JLabel.LEFT); addFieldButton.setOpaque(false); addFieldButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent mouseEvent) { addFieldButton.setIcon(addElementOver); } @Override public void mouseExited(MouseEvent mouseEvent) { addFieldButton.setIcon(addElement); } public void mousePressed(MouseEvent event) { addFieldButton.setIcon(addElement); showAddFieldUI(); } }); addFieldButton.setToolTipText( "<html><b>Add Field to table</b><p>Add a new field to currently selected table</b></p></html>"); removeElementButton = new JLabel(removeElement, JLabel.LEFT); removeElementButton.setOpaque(false); removeElementButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent mouseEvent) { removeElementButton.setIcon(removeElementOver); } @Override public void mouseExited(MouseEvent mouseEvent) { removeElementButton.setIcon(removeElement); } public void mousePressed(MouseEvent event) { removeElementButton.setIcon(removeElement); if (removeElementButton.isEnabled()) { removeSelectedElement(); } } }); removeElementButton.setToolTipText( "<html><b>Remove Field from table</b><p>Remove this field from this list and the currently selected table.</b></p></html>"); final JLabel moveDownButton = new JLabel(moveDown); moveDownButton.setOpaque(false); moveDownButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent mouseEvent) { moveDownButton.setIcon(moveDownOver); } @Override public void mouseExited(MouseEvent mouseEvent) { moveDownButton.setIcon(moveDown); } public void mousePressed(MouseEvent event) { moveDownButton.setIcon(moveDown); if (elementList.getSelectedIndex() != -1) { int toMoveDown = elementList.getSelectedIndex(); if (toMoveDown != (elementModel.getSize() - 1)) { swapElements(elementList, elementModel, toMoveDown, toMoveDown + 1); } updateFieldOrder(); validateFormOrTable(ApplicationManager.getCurrentMappingObject()); } } }); moveDownButton.setToolTipText( "<html><b>Move Field Down</b><p>Move the selected field down <b>one</b> position in the list.</p></html>"); final JLabel moveUpButton = new JLabel(moveUp); moveUpButton.setOpaque(false); moveUpButton.addMouseListener(new MouseAdapter() { @Override public void mouseEntered(MouseEvent mouseEvent) { moveUpButton.setIcon(moveUpOver); } @Override public void mouseExited(MouseEvent mouseEvent) { moveUpButton.setIcon(moveUp); } public void mousePressed(MouseEvent event) { moveUpButton.setIcon(moveUp); if (elementList.getSelectedIndex() != -1) { int toMoveUp = elementList.getSelectedIndex(); if (toMoveUp != 0) { swapElements(elementList, elementModel, toMoveUp, toMoveUp - 1); } updateFieldOrder(); validateFormOrTable(ApplicationManager.getCurrentMappingObject()); } } }); moveUpButton.setToolTipText( "<html><b>Move Field Up</b><p>Move the selected field up <b>one</b> position in the list.</p></html>"); buttonPanel.add(addFieldButton); buttonPanel.add(removeElementButton); buttonPanel.add(moveDownButton); buttonPanel.add(moveUpButton); container.add(buttonPanel); container.add(Box.createVerticalGlue()); return container; }
From source file:org.isatools.isacreatorconfigurator.configui.FieldInterface.java
private void instantiateFields(String initFieldName) { // OVERALL CONTAINER JPanel container = new JPanel(); container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS)); container.setBackground(UIHelper.BG_COLOR); JLabel fieldDefinitionLab = new JLabel(fieldDefinitionHeader, JLabel.CENTER); container.add(fieldDefinitionLab);//from w ww. j ava2s . co m container.add(Box.createVerticalStrut(5)); // FIELD LABEL & INPUT BOX CONTAINER JPanel fieldCont = new JPanel(new GridLayout(1, 2)); fieldCont.setBackground(UIHelper.BG_COLOR); fieldName = new RoundedJTextField(15); fieldName.setText(initFieldName); fieldName.setEditable(false); UIHelper.renderComponent(fieldName, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JLabel fieldNameLab = UIHelper.createLabel("Field Name: ", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); fieldCont.add(fieldNameLab); fieldCont.add(fieldName); container.add(fieldCont); JPanel descCont = new JPanel(new GridLayout(1, 2)); descCont.setBackground(UIHelper.BG_COLOR); description = new RoundedJTextArea(); description.setLineWrap(true); description.setWrapStyleWord(true); UIHelper.renderComponent(description, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane descScroll = new JScrollPane(description, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); descScroll.setBackground(UIHelper.BG_COLOR); descScroll.setPreferredSize(new Dimension(150, 65)); descScroll.getViewport().setBackground(UIHelper.BG_COLOR); IAppWidgetFactory.makeIAppScrollPane(descScroll); JLabel descLab = UIHelper.createLabel("Description: ", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); descLab.setVerticalAlignment(JLabel.TOP); descCont.add(descLab); descCont.add(descScroll); container.add(descCont); // add datatype information JPanel datatypeCont = new JPanel(new GridLayout(1, 2)); datatypeCont.setBackground(UIHelper.BG_COLOR); DataTypes[] allowedDataTypes = initFieldName.equals(UNIT_STR) ? new DataTypes[] { DataTypes.ONTOLOGY_TERM } : DataTypes.values(); datatype = new JComboBox(allowedDataTypes); datatype.addActionListener(this); UIHelper.renderComponent(datatype, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, UIHelper.BG_COLOR); JLabel dataTypeLab = UIHelper.createLabel("Datatype:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); datatypeCont.add(dataTypeLab); datatypeCont.add(datatype); container.add(datatypeCont); defaultValContStd = new JPanel(new GridLayout(1, 2)); defaultValContStd.setBackground(UIHelper.BG_COLOR); defaultValCont = Box.createHorizontalBox(); defaultValCont.setPreferredSize(new Dimension(150, 25)); defaultValStd = new RoundedFormattedTextField(null, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR, UIHelper.DARK_GREEN_COLOR); defaultValCont.setPreferredSize(new Dimension(120, 25)); defaultValStd.setFormatterFactory(new DefaultFormatterFactory( new RegExFormatter(".*", defaultValStd, false, UIHelper.DARK_GREEN_COLOR, UIHelper.RED_COLOR, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR))); defaultValStd.setForeground(UIHelper.DARK_GREEN_COLOR); defaultValStd.setFont(UIHelper.VER_11_PLAIN); defaultValCont.add(defaultValStd); defaultValLabStd = UIHelper.createLabel(DEFAULT_VAL_STR, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); defaultValContStd.add(defaultValLabStd); defaultValContStd.add(defaultValCont); container.add(defaultValContStd); defaultValContBool = new JPanel(new GridLayout(1, 2)); defaultValContBool.setBackground(UIHelper.BG_COLOR); defaultValContBool.setVisible(false); listDataSourceCont = new JPanel(new GridLayout(2, 1)); listDataSourceCont.setBackground(UIHelper.BG_COLOR); listDataSourceCont.setVisible(false); JLabel listValLab = UIHelper.createLabel("Please enter comma separated list of values:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); listDataSourceCont.add(listValLab); listValues = new RoundedJTextArea("SampleVal1, SampleVal2, SampleVal3", 3, 5); listValues.setLineWrap(true); listValues.setWrapStyleWord(true); UIHelper.renderComponent(listValues, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane listScroll = new JScrollPane(listValues, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); listScroll.setBackground(UIHelper.BG_COLOR); listScroll.getViewport().setBackground(UIHelper.BG_COLOR); listDataSourceCont.add(listScroll); container.add(listDataSourceCont); IAppWidgetFactory.makeIAppScrollPane(listScroll); sourceEntryPanel = new JPanel(new BorderLayout()); sourceEntryPanel.setSize(new Dimension(125, 190)); sourceEntryPanel.setOpaque(false); sourceEntryPanel.setVisible(false); preferredOntologySource = new JPanel(); preferredOntologySource.setLayout(new BoxLayout(preferredOntologySource, BoxLayout.PAGE_AXIS)); preferredOntologySource.setVisible(false); recommendOntologySource = new JCheckBox("Use recommended ontology source?", false); UIHelper.renderComponent(recommendOntologySource, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); recommendOntologySource.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (recommendOntologySource.isSelected()) { sourceEntryPanel.setVisible(true); } else { sourceEntryPanel.setVisible(false); } } }); JPanel useOntologySourceCont = new JPanel(new GridLayout(1, 1)); useOntologySourceCont.add(recommendOntologySource); preferredOntologySource.add(useOntologySourceCont); JPanel infoCont = new JPanel(new GridLayout(1, 1)); JLabel infoLab = UIHelper.createLabel( "<html>click on the <strong>configure ontologies</strong> button to open the ontology configurator to edit the list of ontologies and search areas within an ontology</html>", UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR); infoLab.setPreferredSize(new Dimension(100, 40)); infoCont.add(infoLab); sourceEntryPanel.add(infoCont, BorderLayout.NORTH); JLabel preferredOntologiesLab = new JLabel(preferredOntologiesSidePanelIcon); preferredOntologiesLab.setVerticalAlignment(SwingConstants.TOP); sourceEntryPanel.add(preferredOntologiesLab, BorderLayout.WEST); ontologiesToUseModel = new DefaultTableModel(new String[0][2], ontologyColumnHeaders) { @Override public boolean isCellEditable(int i, int i1) { return false; } }; ontologiesToUse = new JTable(ontologiesToUseModel); ontologiesToUse.getTableHeader().setBackground(UIHelper.BG_COLOR); try { ontologiesToUse.setDefaultRenderer(Class.forName("java.lang.Object"), new CustomSpreadsheetCellRenderer()); } catch (ClassNotFoundException e) { // empty } renderTableHeader(); JScrollPane ontologiesToUseScroller = new JScrollPane(ontologiesToUse, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); ontologiesToUseScroller.setBorder(new EmptyBorder(0, 0, 0, 0)); ontologiesToUseScroller.setPreferredSize(new Dimension(100, 80)); ontologiesToUseScroller.setBackground(UIHelper.BG_COLOR); ontologiesToUseScroller.getViewport().setBackground(UIHelper.BG_COLOR); IAppWidgetFactory.makeIAppScrollPane(ontologiesToUseScroller); sourceEntryPanel.add(ontologiesToUseScroller); JPanel buttonCont = new JPanel(new BorderLayout()); final JLabel openConfigButton = new JLabel(ontologyConfigIcon); openConfigButton.setVerticalAlignment(SwingConstants.TOP); openConfigButton.setHorizontalAlignment(SwingConstants.RIGHT); MouseAdapter showOntologyConfigurator = new MouseAdapter() { public void mouseEntered(MouseEvent mouseEvent) { openConfigButton.setIcon(ontologyConfigIconOver); } public void mouseExited(MouseEvent mouseEvent) { openConfigButton.setIcon(ontologyConfigIcon); } public void mousePressed(MouseEvent mouseEvent) { SwingUtilities.invokeLater(new Runnable() { public void run() { if (openConfigButton.isEnabled()) { openConfigButton.setIcon(ontologyConfigIcon); ontologyConfig = new OntologyConfigUI(ontologiesToQuery, selectedOntologies); ontologyConfig.addPropertyChangeListener("ontologySelected", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { selectedOntologies = (ListOrderedMap<String, RecommendedOntology>) propertyChangeEvent .getNewValue(); updateTable(); } }); showPopupInCenter(ontologyConfig); } } }); } }; openConfigButton.addMouseListener(showOntologyConfigurator); buttonCont.add(openConfigButton, BorderLayout.EAST); sourceEntryPanel.add(buttonCont, BorderLayout.SOUTH); preferredOntologySource.add(sourceEntryPanel); container.add(preferredOntologySource); String[] contents = new String[] { "true", "false" }; defaultValBool = new JComboBox(contents); UIHelper.renderComponent(defaultValBool, UIHelper.VER_12_PLAIN, UIHelper.DARK_GREEN_COLOR, UIHelper.BG_COLOR); JLabel defaultValLabBool = UIHelper.createLabel(DEFAULT_VAL_STR, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR); defaultValContBool.add(defaultValLabBool); defaultValContBool.add(defaultValBool); container.add(defaultValContBool); // RegExp data entry isInputFormatted = new JCheckBox("Is the input formatted?", false); isInputFormatted.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); isInputFormatted.setHorizontalAlignment(SwingConstants.LEFT); UIHelper.renderComponent(isInputFormatted, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); isInputFormatted.addActionListener(this); container.add(UIHelper.wrapComponentInPanel(isInputFormatted)); inputFormatCont = new JPanel(); inputFormatCont.setLayout(new BoxLayout(inputFormatCont, BoxLayout.LINE_AXIS)); inputFormatCont.setVisible(false); inputFormatCont.setBackground(UIHelper.BG_COLOR); inputFormat = new RoundedJTextField(10); inputFormat.setText(".*"); inputFormat.setSize(new Dimension(150, 19)); inputFormat.setPreferredSize(new Dimension(160, 25)); inputFormat.setToolTipText("Field expects a regular expression describing the input format."); UIHelper.renderComponent(inputFormat, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JLabel inputFormatLab = UIHelper.createLabel("Input format:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); inputFormatLab.setVerticalAlignment(SwingConstants.TOP); inputFormatCont.add(inputFormatLab); inputFormatCont.add(inputFormat); JLabel checkRegExp = new JLabel(checkRegExIcon, JLabel.RIGHT); checkRegExp.setOpaque(false); checkRegExp.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { String regexToCheck = inputFormat.getText(); final CheckRegExGUI regexChecker = new CheckRegExGUI(regexToCheck); SwingUtilities.invokeLater(new Runnable() { public void run() { regexChecker.createGUI(); } }); regexChecker.addPropertyChangeListener("close", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { main.getApplicationContainer().hideSheet(); } }); SwingUtilities.invokeLater(new Runnable() { public void run() { main.getApplicationContainer().showJDialogAsSheet(regexChecker); } }); } } ); inputFormatCont.add(checkRegExp); container.add(inputFormatCont); usesTemplateForWizard = new JCheckBox("Requires template for wizard?", false); usesTemplateForWizard.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); usesTemplateForWizard.setHorizontalAlignment(SwingConstants.LEFT); UIHelper.renderComponent(usesTemplateForWizard, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); usesTemplateForWizard.addActionListener(this); container.add(UIHelper.wrapComponentInPanel(usesTemplateForWizard)); wizardTemplatePanel = new JPanel(new GridLayout(1, 2)); wizardTemplatePanel.setVisible(false); wizardTemplatePanel.setBackground(UIHelper.BG_COLOR); wizardTemplate = new RoundedJTextArea(); wizardTemplate.setToolTipText("A template for the wizard to auto-create the data..."); wizardTemplate.setLineWrap(true); wizardTemplate.setWrapStyleWord(true); UIHelper.renderComponent(wizardTemplate, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); JScrollPane wizScroll = new JScrollPane(wizardTemplate, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); wizScroll.getViewport().setBackground(UIHelper.BG_COLOR); wizScroll.setPreferredSize(new Dimension(70, 60)); IAppWidgetFactory.makeIAppScrollPane(wizScroll); JLabel wizardTemplateLab = UIHelper.createLabel("Template definition:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR); wizardTemplateLab.setVerticalAlignment(JLabel.TOP); wizardTemplatePanel.add(wizardTemplateLab); wizardTemplatePanel.add(wizScroll); container.add(wizardTemplatePanel); JPanel checkCont = new JPanel(new GridLayout(3, 2)); checkCont.setBackground(UIHelper.BG_COLOR); checkCont.setBorder(new TitledBorder(new RoundedBorder(UIHelper.DARK_GREEN_COLOR, 4), "Behavioural Attributes", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR)); required = new JCheckBox("Required ", true); UIHelper.renderComponent(required, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(required); acceptsMultipleValues = new JCheckBox("Allow multiple instances", false); UIHelper.renderComponent(acceptsMultipleValues, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(acceptsMultipleValues); acceptsFileLocations = new JCheckBox("Accepts file locations", false); acceptsFileLocations.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { acceptsMultipleValues.setSelected(false); acceptsMultipleValues.setEnabled(!acceptsFileLocations.isSelected()); } }); UIHelper.renderComponent(acceptsFileLocations, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(acceptsFileLocations); hidden = new JCheckBox("hidden?", false); UIHelper.renderComponent(hidden, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(hidden); forceOntologySelection = new JCheckBox("Force ontology selection", false); UIHelper.renderComponent(forceOntologySelection, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false); checkCont.add(forceOntologySelection); container.add(checkCont); JScrollPane contScroll = new JScrollPane(container, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); contScroll.setBorder(null); contScroll.setAutoscrolls(true); IAppWidgetFactory.makeIAppScrollPane(contScroll); add(contScroll, BorderLayout.NORTH); }
From source file:org.jannocessor.ui.RenderPreviewDialog.java
private void initialize() { logger.debug("Initializing UI..."); DefaultSyntaxKit.initKit();/*from w ww .ja va 2 s . c om*/ JEditorPane.registerEditorKitForContentType("text/java_template", "org.jannocessor.syntax.JavaTemplateKit", getClass().getClassLoader()); JEditorPane.registerEditorKitForContentType("text/java_output", "org.jannocessor.syntax.JavaOutputKit", getClass().getClassLoader()); setTitle("JAnnocessor - Java Annotation Processor"); setLayout(new BorderLayout(5, 5)); listFiles(); Toolkit tk = Toolkit.getDefaultToolkit(); Dimension screenSize = tk.getScreenSize(); double width = screenSize.getWidth() * 0.9; double height = screenSize.getHeight() * 0.8; // Font font = new Font("Courier New", Font.PLAIN, 14); input = createInput(); JScrollPane scroll1 = new JScrollPane(input, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); input.setContentType("text/java_template"); input.setText(""); scroll1.setMinimumSize(new Dimension(200, 200)); scroll1.setPreferredSize(new Dimension((int) (width * 0.5), (int) height)); add(scroll1, BorderLayout.CENTER); output = Box.createVerticalBox(); scroll2 = new JScrollPane(output, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); scroll2.setMinimumSize(new Dimension(200, 200)); scroll2.setPreferredSize(new Dimension((int) (width * 0.5), (int) height)); add(scroll2, BorderLayout.EAST); combo = createCombo(); combo.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { load((File) combo.getSelectedItem()); } }); add(combo, BorderLayout.NORTH); JLabel help = new JLabel( " Choose a template from the drop-down box to edit it. Navigation: Alt + Left & Alt + Right; Refresh = F5, Close = Esc", JLabel.CENTER); help.setForeground(Color.WHITE); help.setBackground(Color.BLACK); help.setOpaque(true); help.setFont(new Font("Courier New", Font.BOLD, 14)); add(help, BorderLayout.SOUTH); keyListener = new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_F5) { e.consume(); processElements(); refresh(); } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) { e.consume(); dispose(); } else if (e.getKeyCode() == KeyEvent.VK_LEFT && e.isAltDown()) { e.consume(); moveBackward(); } else if (e.getKeyCode() == KeyEvent.VK_RIGHT && e.isAltDown()) { e.consume(); moveForward(); } else if (e.getKeyCode() == KeyEvent.VK_S && e.isControlDown()) { e.consume(); save(); } else if (e.getKeyCode() == KeyEvent.VK_I && e.isControlDown()) { e.consume(); increase(); } else if (e.getKeyCode() == KeyEvent.VK_D && e.isControlDown()) { e.consume(); decrease(); } } }; input.addKeyListener(keyListener); combo.addKeyListener(keyListener); setActive(0); pack(); setModal(true); setLocationRelativeTo(null); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); input.requestFocus(); logger.debug("Initialized UI."); }
From source file:org.jimcat.gui.perspective.boards.cards.Card.java
/** * build up swing componets/* w ww. j a v a 2 s .c om*/ */ private void initComponents() { setOpaque(false); setBorder(new RoundedShadowBorder(15)); setLayout(new BorderLayout()); setBackground(new Color(255, 140, 0, 100)); viewer = new FramedImageViewer(); viewer.setGraphicSize(new Dimension(140, 140)); add(viewer, orientation.getBorderLayoutConstant()); JLabel tmp = null; // General info list JPanel labelPanel = new JPanel(); labelPanel.setOpaque(false); labelPanel.setBorder(new EmptyBorder(0, 0, 0, 10)); labelPanel.setLayout(new GridLayout(0, 1)); JPanel contentPanel = new JPanel(); contentPanel.setOpaque(false); contentPanel.setLayout(new GridLayout(0, 1)); tmp = new JLabel("Title"); tmp.setFont(labelFont); labelPanel.add(tmp); tmp.setOpaque(false); contentPanel.add(title); tmp = new JLabel("Date Taken"); tmp.setFont(labelFont); labelPanel.add(tmp); tmp.setOpaque(false); taken = new JLabel(); contentPanel.add(taken); tmp = new JLabel("Dimension"); tmp.setFont(labelFont); tmp.setOpaque(false); labelPanel.add(tmp); dimension = new JLabel(""); contentPanel.add(dimension); tmp = new JLabel("Size"); tmp.setFont(labelFont); tmp.setOpaque(false); labelPanel.add(tmp); size = new JLabel(""); contentPanel.add(size); tmp = new JLabel("File path"); tmp.setFont(labelFont); tmp.setOpaque(false); labelPanel.add(tmp); path = new JLabel(""); path.setToolTipText(""); path.addMouseListener(new MouseEventsToCardGrandParentShifter()); contentPanel.add(path); tmp = new JLabel("Rating"); tmp.setFont(labelFont); tmp.setOpaque(false); labelPanel.add(tmp); rating = new RatingEditor(); JPanel ratingWrapper = new JPanel(new BorderLayout()); ratingWrapper.setOpaque(false); ratingWrapper.add(rating, BorderLayout.WEST); contentPanel.add(ratingWrapper); // free line tmp = new JLabel(); tmp.setOpaque(false); labelPanel.add(tmp); tmp = new JLabel(); contentPanel.add(tmp); // tags tmp = new JLabel("Tags"); tmp.setFont(labelFont); tmp.setOpaque(false); labelPanel.add(tmp); tags = new JLabel(""); tags.setToolTipText(""); tags.addMouseListener(new MouseEventsToCardGrandParentShifter()); contentPanel.add(tags); // albums tmp = new JLabel("Albums"); tmp.setFont(labelFont); tmp.setOpaque(false); labelPanel.add(tmp); albums = new JLabel(""); albums.setToolTipText(""); albums.addMouseListener(new MouseEventsToCardGrandParentShifter()); contentPanel.add(albums); JPanel info = new JPanel(); info.setOpaque(false); info.setLayout(new BorderLayout()); info.setBorder(new EmptyBorder(20, 10, 10, 0)); info.add(labelPanel, BorderLayout.WEST); info.add(contentPanel, BorderLayout.CENTER); JPanel infoHolder = new JPanel(); infoHolder.setOpaque(false); infoHolder.setLayout(new BorderLayout()); infoHolder.add(info, BorderLayout.NORTH); add(infoHolder, BorderLayout.CENTER); }
From source file:org.martin.ftp.model.TCRFiles.java
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel lbl = new JLabel(); ImageIcon icon;/* w w w. ja v a 2 s . c om*/ FTPFile file = files.get(row); if (column == 0) { if (file.isDirectory()) icon = new ImageIcon(getClass().getResource("/org/martin/ftp/resources/folder.png")); else icon = new ImageIcon(getClass().getResource("/org/martin/ftp/resources/file.png")); lbl.setIcon(icon); lbl.setText(file.getName()); } else lbl.setText(value.toString()); Color bg = lbl.getBackground(); if (isSelected) lbl.setBackground(Color.CYAN); else if (row == foundFileIndex) lbl.setBackground(Color.RED); else lbl.setBackground(bg); lbl.setOpaque(true); return lbl; }
From source file:org.martin.ftp.model.TCRSearch.java
@Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JLabel lbl = new JLabel(); ImageIcon icon;/*ww w .jav a 2s .c o m*/ FTPFile file = files.get(row).getFile(); if (column == 0) { if (file.isDirectory()) icon = new ImageIcon(getClass().getResource("/org/martin/ftp/resources/folder.png")); else icon = new ImageIcon(getClass().getResource("/org/martin/ftp/resources/file.png")); lbl.setIcon(icon); lbl.setText(file.getName()); } else lbl.setText(value.toString()); Color bg = lbl.getBackground(); if (isSelected) lbl.setBackground(Color.CYAN); else lbl.setBackground(bg); lbl.setOpaque(true); return lbl; }
From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java
private void initUI() { setMinimumSize(new Dimension(550, 160)); setLayout(new BorderLayout()); setOpaque(true);/* w w w . j a v a 2s .c om*/ setBackground(ColorAndFontConstants.VERY_LIGHT_BACKGROUND_COLOR); JPanel mainPanel = new JPanel(); mainPanel.setOpaque(false); String[] keys = new String[] { "fontChooser.fontName", "fontChooser.fontStyle", "fontChooser.fontSize", "showPreferencesPanel.ticker.exchange", "showPreferencesPanel.ticker.currency", "showPreferencesPanel.lookAndFeel", "showPreferencesPanel.oerLabel.text" }; int stentWidth = MultiBitTitledPanel.calculateStentWidthForKeys(controller.getLocaliser(), keys, this) + STENT_DELTA; GridBagConstraints constraints = new GridBagConstraints(); mainPanel.setLayout(new GridBagLayout()); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 1; constraints.gridwidth = 2; constraints.weightx = 1; constraints.weighty = 1.6; constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING; // Disable language selection, uncomment to enable // mainPanel.add(createLanguagePanel(stentWidth), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 2; constraints.gridwidth = 2; constraints.weightx = 1; constraints.weighty = 1.6; constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING; mainPanel.add(createAppearancePanel(stentWidth), constraints); constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 3; constraints.gridwidth = 2; constraints.weightx = 1; constraints.weighty = 1.6; constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING; mainPanel.add(createMessagingServerPanel(stentWidth), constraints); /* constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 3; constraints.gridwidth = 2; constraints.weightx = 1; constraints.weighty = 1.6; constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING; mainPanel.add(createTickerPanel(stentWidth), constraints); */ constraints.fill = GridBagConstraints.HORIZONTAL; constraints.gridx = 0; constraints.gridy = 4; constraints.gridwidth = 2; constraints.weightx = 1; constraints.weighty = 1.6; constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING; mainPanel.add(createBrowserIntegrationPanel(stentWidth), constraints); JLabel filler1 = new JLabel(); filler1.setOpaque(false); constraints.fill = GridBagConstraints.BOTH; constraints.gridx = 0; constraints.gridy = 5; constraints.gridwidth = 2; constraints.weightx = 1; constraints.weighty = 100; constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING; mainPanel.add(filler1, constraints); JScrollPane mainScrollPane = new JScrollPane(mainPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); mainScrollPane.setBorder(BorderFactory.createEmptyBorder()); mainScrollPane.getViewport().setBackground(ColorAndFontConstants.VERY_LIGHT_BACKGROUND_COLOR); mainScrollPane.getViewport().setOpaque(true); mainScrollPane.getHorizontalScrollBar().setUnitIncrement(CoreModel.SCROLL_INCREMENT); mainScrollPane.getVerticalScrollBar().setUnitIncrement(CoreModel.SCROLL_INCREMENT); add(mainScrollPane, BorderLayout.CENTER); JPanel buttonPanel = createButtonPanel(); buttonPanel.setMinimumSize(new Dimension(60, 60)); add(buttonPanel, BorderLayout.SOUTH); }
From source file:org.openconcerto.erp.core.finance.accounting.ui.EtatJournauxPanel.java
private JPanel initJournalPanel(final Journal jrnl) { final JPanel panelTmp = new JPanel(); long totalDebitJournal = 0; long totalCreditJournal = 0; panelTmp.setLayout(new GridBagLayout()); final GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(2, 2, 1, 2); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.NORTHWEST; c.gridx = 0;/* ww w .ja va 2s . c om*/ c.gridy = 0; c.gridwidth = 1; c.gridheight = 1; c.weightx = 1; c.weighty = 0; String req = "SELECT DISTINCT EXTRACT(YEAR FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\"), " + "EXTRACT(MONTH FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\")," + " SUM(\"" + baseName + "\".\"ECRITURE\".\"DEBIT\"), " + "SUM(\"" + baseName + "\".\"ECRITURE\".\"CREDIT\")" + " FROM \"" + baseName + "\".\"ECRITURE\" " + "WHERE (\"" + baseName + "\".\"ECRITURE\".\"ID\" != 1) " + "AND ((\"" + baseName + "\".\"ECRITURE\".\"ARCHIVE\" = 0) " + "AND (\"" + baseName + "\".\"ECRITURE\".\"ID_JOURNAL\" = " + jrnl.getId() + ")) " + "GROUP BY EXTRACT(YEAR FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\"), " + "EXTRACT(MONTH FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\") " + "ORDER BY EXTRACT(YEAR FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\"), " + "EXTRACT(MONTH FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\")"; System.out.println(req); Object ob = base.getDataSource().execute(req, new ArrayListHandler()); List myList = (List) ob; // System.err.println("TEST DATE " + t); if (myList.size() != 0) { for (int i = 0; i < myList.size(); i++) { Object[] objTmp = (Object[]) myList.get(i); Calendar cal = Calendar.getInstance(); cal.set(Calendar.DATE, 1); int month = (new Double(objTmp[1].toString()).intValue() - 1); System.err.println(jrnl.getNom() + " SET MONTH " + month); cal.set(Calendar.MONTH, month); System.err.println(month + " = " + cal.getTime()); cal.set(Calendar.YEAR, new Double(objTmp[0].toString()).intValue()); long debitMois = ((Number) objTmp[2]).longValue(); long creditMois = ((Number) objTmp[3]).longValue(); c.gridwidth = GridBagConstraints.REMAINDER; final JPanel creerJournalMoisPanel = creerJournalMoisPanel(cal.getTime(), debitMois, creditMois, jrnl); creerJournalMoisPanel.setOpaque(false); panelTmp.add(creerJournalMoisPanel, c); c.gridy++; totalDebitJournal += debitMois; totalCreditJournal += creditMois; } } c.gridx = 0; c.weighty = 1; c.gridwidth = 1; final JLabel label = new JLabel("Journal " + jrnl.getNom()); label.setOpaque(false); panelTmp.add(label, c); c.gridx = GridBagConstraints.RELATIVE; panelTmp.add(new JLabel(" Total dbit : " + GestionDevise.currencyToString(totalDebitJournal)), c); panelTmp.add(new JLabel(" Total crdit : " + GestionDevise.currencyToString(totalCreditJournal)), c); return panelTmp; }