List of usage examples for javax.swing JPanel setOpaque
@BeanProperty(expert = true, description = "The component's opacity") public void setOpaque(boolean isOpaque)
From source file:org.isatools.isacreator.wizard.AddAssayPane.java
public JComponent createCenterPanel() { JPanel centerPanel = new JPanel(); centerPanel.setLayout(new BoxLayout(centerPanel, BoxLayout.PAGE_AXIS)); centerPanel.setOpaque(false); centerPanel.add(Box.createVerticalStrut(15)); String sourceNameFormat = ConfigurationManager.selectTROForUserSelection(MappingObject.STUDY_SAMPLE) .getColumnFormatByName("source name"); String[] arrayDesigns = retrieveArrayDesigns(); for (Assay a : assaysToDefine) { if (a.getTechnologyType().equalsIgnoreCase("dna microarray")) { MicroarrayCreationAlgorithm maAlg = new MicroarrayCreationAlgorithm(study, a, factorsToAdd, treatmentGroups,//from w w w.jav a 2s . c o m new TableReferenceObject(ConfigurationManager .selectTROForUserSelection(a.getMeasurementEndpoint(), a.getTechnologyType()) .getTableFields()), up.getInstitution(), sourceNameFormat, arrayDesigns); algorithmsToRun.add(maAlg); centerPanel.add(maAlg); } else { GeneralCreationAlgorithm gca = new GeneralCreationAlgorithm(study, a, factorsToAdd, treatmentGroups, new TableReferenceObject(ConfigurationManager .selectTROForUserSelection(a.getMeasurementEndpoint(), a.getTechnologyType()) .getTableFields()), up.getInstitution(), sourceNameFormat); algorithmsToRun.add(gca); centerPanel.add(gca); } } JScrollPane assayScroller = new JScrollPane(centerPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); assayScroller.setBackground(UIHelper.BG_COLOR); assayScroller.setBorder(null); assayScroller.getViewport().setOpaque(false); assayScroller.getViewport().putClientProperty("EnableWindowBlit", Boolean.TRUE); IAppWidgetFactory.makeIAppScrollPane(assayScroller); return abstractDataEntryEnvironment.getGeneralLayout( new ImageIcon(getClass().getResource("/images/wizard/defineassay.png")), new ImageIcon(getClass().getResource("/images/wizard/BC_4.png")), "Please provide some information about these assays...", assayScroller, getHeight()); }
From source file:org.isatools.isacreator.wizard.MicroarrayCreationAlgorithm.java
private JPanel instantiatePanel() { final JPanel microArrayQuestionCont = new JPanel(); microArrayQuestionCont.setLayout(new BoxLayout(microArrayQuestionCont, BoxLayout.PAGE_AXIS)); microArrayQuestionCont.setOpaque(false); StringBuilder text = new StringBuilder("<html><b>" + assay.getMeasurementEndpoint() + "</b> using <b>" + assay.getTechnologyType() + "</b>"); if (!StringUtils.isEmpty(assay.getAssayPlatform())) { text.append(" on <b>").append(assay.getAssayPlatform()).append("</b>"); }/* www.ja v a 2s . c o m*/ JLabel info = new JLabel(text.append("</html>").toString(), JLabel.LEFT); UIHelper.renderComponent(info, UIHelper.VER_12_PLAIN, UIHelper.GREY_COLOR, false); info.setPreferredSize(new Dimension(300, 40)); JPanel infoPanel = new JPanel(new GridLayout(1, 1)); infoPanel.setOpaque(false); infoPanel.add(info); microArrayQuestionCont.add(infoPanel); // create reference sample used checkbox JPanel labelPanel = new JPanel(new GridLayout(2, 2)); labelPanel.setBackground(UIHelper.BG_COLOR); final DataEntryForm studyUISection = ApplicationManager.getUserInterfaceForISASection(study); System.out.println("Study user interface is null? " + (studyUISection == null)); System.out .println("Study user interface dep is null? " + (studyUISection.getDataEntryEnvironment() == null)); label1Capture = new LabelCapture("Label (e.g. Cy3)"); label2Capture = new LabelCapture("Label (e.g. Cy5)"); label2Capture.setVisible(false); // create dye swap check box dyeSwapUsed = new JCheckBox("dye-swap performed?", false); UIHelper.renderComponent(dyeSwapUsed, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false); dyeSwapUsed.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { label2Capture.setVisible(dyeSwapUsed.isSelected()); } }); labelPanel.add(UIHelper.createLabel("Label(s) used")); labelPanel.add(label1Capture); labelPanel.add(dyeSwapUsed); labelPanel.add(label2Capture); microArrayQuestionCont.add(labelPanel); final JPanel extractPanel = new JPanel(new GridLayout(2, 2)); extractPanel.setOpaque(false); extractDetails.clear(); JLabel extractsUsedLab = UIHelper.createLabel("sample(s) used *"); extractsUsedLab.setHorizontalAlignment(JLabel.LEFT); extractsUsedLab.setVerticalAlignment(JLabel.TOP); final JPanel extractNameContainer = new JPanel(); extractNameContainer.setLayout(new BoxLayout(extractNameContainer, BoxLayout.PAGE_AXIS)); extractNameContainer.setOpaque(false); extract = new ExtractDetailsCapture("Sample " + (extractDetails.size() + 1), studyUISection.getDataEntryEnvironment()); extractDetails.add(extract); extractNameContainer.add(extract); JLabel addExtractButton = new JLabel("add sample", addRecordIcon, JLabel.RIGHT); UIHelper.renderComponent(addExtractButton, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false); addExtractButton.setVerticalAlignment(JLabel.TOP); addExtractButton.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { extract = new ExtractDetailsCapture("Sample " + (extractDetails.size() + 1), studyUISection.getDataEntryEnvironment()); extractDetails.add(extract); extractNameContainer.add(extract); extractNameContainer.revalidate(); microArrayQuestionCont.revalidate(); } }); addExtractButton.setToolTipText( "<html><b>add new sample</b><p>add another sample (e.g. Liver, Heart, Urine, Blood)</p></html>"); JLabel removeExtractButton = new JLabel("remove sample", removeIcon, JLabel.RIGHT); removeExtractButton.setVerticalAlignment(JLabel.TOP); UIHelper.renderComponent(removeExtractButton, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false); removeExtractButton.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if (extractDetails.size() > 1) { extract = extractDetails.get(extractDetails.size() - 1); extractDetails.remove(extract); extractNameContainer.remove(extract); microArrayQuestionCont.revalidate(); } } }); removeExtractButton.setToolTipText( "<html><b>remove previously added sample</b><p>remove the array design field last added</p></html>"); extractPanel.add(extractsUsedLab); extractPanel.add(extractNameContainer); JPanel extractButtonContainer = new JPanel(new GridLayout(1, 2)); extractButtonContainer.setOpaque(false); extractButtonContainer.add(addExtractButton); extractButtonContainer.add(removeExtractButton); extractPanel.add(new JLabel()); extractPanel.add(extractButtonContainer); microArrayQuestionCont.add(extractPanel); // ask for array designs used... // create array designs panel final JPanel arrayDesignPanel = new JPanel(new GridLayout(2, 2)); arrayDesignPanel.setOpaque(false); arrayDesignsUsed.clear(); JLabel arrayDesignLab = UIHelper.createLabel("array design(s) used *"); arrayDesignLab.setVerticalAlignment(JLabel.TOP); // the array designs container must adjust to an unknown number of fields. therefore, a JPanel with a BoxLayout // will be used since it is flexible! final JPanel arrayDesignsContainer = new JPanel(); arrayDesignsContainer.setLayout(new BoxLayout(arrayDesignsContainer, BoxLayout.PAGE_AXIS)); arrayDesignsContainer.setOpaque(false); newArrayDesign = new AutoFilterCombo(arrayDesigns, true); UIHelper.renderComponent(newArrayDesign, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); newArrayDesign.setPreferredSize(new Dimension(70, 30)); arrayDesignsContainer.add(newArrayDesign); arrayDesignsUsed.add(newArrayDesign); JLabel addButton = new JLabel("add design", addRecordIcon, JLabel.RIGHT); UIHelper.renderComponent(addButton, UIHelper.VER_10_PLAIN, UIHelper.DARK_GREEN_COLOR, false); addButton.setVerticalAlignment(JLabel.TOP); addButton.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { newArrayDesign = new AutoFilterCombo(arrayDesigns, true); UIHelper.renderComponent(newArrayDesign, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false); newArrayDesign.setPreferredSize(new Dimension(70, 30)); arrayDesignsUsed.add(newArrayDesign); arrayDesignsContainer.add(newArrayDesign); arrayDesignsContainer.revalidate(); microArrayQuestionCont.revalidate(); } }); addButton.setToolTipText("<html><b>add new array design</b><p>add another array design</p></html>"); JLabel removeButton = new JLabel("remove design", removeIcon, JLabel.RIGHT); removeButton.setVerticalAlignment(JLabel.TOP); UIHelper.renderComponent(removeButton, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR, false); removeButton.addMouseListener(new MouseAdapter() { public void mousePressed(MouseEvent event) { if (arrayDesignsUsed.size() > 1) { newArrayDesign = arrayDesignsUsed.get(arrayDesignsUsed.size() - 1); arrayDesignsUsed.remove(newArrayDesign); arrayDesignsContainer.remove(newArrayDesign); arrayDesignPanel.revalidate(); microArrayQuestionCont.validate(); } } }); removeButton.setToolTipText( "<html><b>remove previously added array design</b><p>remove the array design field last added</p></html>"); arrayDesignPanel.add(arrayDesignLab); arrayDesignPanel.add(arrayDesignsContainer); JPanel buttonContainer = new JPanel(new GridLayout(1, 2)); buttonContainer.setOpaque(false); buttonContainer.add(addButton); buttonContainer.add(removeButton); arrayDesignPanel.add(new JLabel()); arrayDesignPanel.add(buttonContainer); microArrayQuestionCont.add(arrayDesignPanel); microArrayQuestionCont.add(Box.createVerticalStrut(5)); microArrayQuestionCont.add(Box.createHorizontalGlue()); microArrayQuestionCont.setBorder(new TitledBorder(new RoundedBorder(UIHelper.DARK_GREEN_COLOR, 9), assay.getAssayReference(), TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_12_BOLD, UIHelper.DARK_GREEN_COLOR)); return microArrayQuestionCont; }
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());//from w ww . ja v a 2 s . c om 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 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); JLabel lab = new JLabel(fieldListTitle); headerLab.add(lab);/*from w w w. j av a2s . c o m*/ 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.ontologyconfigurationtool.OntologyConfigUI.java
private void createOntologySelectionPanel() { OntologyListRenderer listRenderer = new OntologyListRenderer(); JPanel westPanel = new JPanel(new BorderLayout()); JPanel selectedOntologiesContainer = new JPanel(new BorderLayout()); selectedOntologiesContainer.setOpaque(false); // create List containing selected ontologies selectedOntologyListModel = new DefaultListModel(); selectedOntologyList = new JList(selectedOntologyListModel); selectedOntologyList.setCellRenderer(new SelectedOntologyListRenderer()); selectedOntologyList.setBackground(UIHelper.BG_COLOR); selectedOntologyList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent listSelectionEvent) { setOntologySelectionPanelPlaceholder(infoImage); setSelectedOntologyButtonVisibility(selectedOntologyList.isSelectionEmpty()); }// w ww.jav a 2 s .c o m }); JScrollPane selectedOntologiesScroller = new JScrollPane(selectedOntologyList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); selectedOntologiesScroller.setPreferredSize(new Dimension(200, 255)); selectedOntologiesScroller.setBackground(UIHelper.BG_COLOR); selectedOntologiesScroller.getViewport().setBackground(UIHelper.BG_COLOR); IAppWidgetFactory.makeIAppScrollPane(selectedOntologiesScroller); selectedOntologiesContainer.setBorder(new TitledBorder(new RoundedBorder(UIHelper.LIGHT_GREEN_COLOR, 7), "selected ontologies", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR)); selectedOntologiesContainer.add(selectedOntologiesScroller, BorderLayout.CENTER); // ADD BUTTONS removeOntologyButton = new JLabel(removeOntologyButtonIcon); removeOntologyButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent mouseEvent) { if (!selectedOntologyList.isSelectionEmpty()) { String ontologyToRemove = selectedOntologyList.getSelectedValue().toString(); System.out.println("Removing " + ontologyToRemove); selectedOntologies.remove(ontologyToRemove); setOntologySelectionPanelPlaceholder(infoImage); updateSelectedOntologies(); } removeOntologyButton.setIcon(removeOntologyButtonIcon); } @Override public void mouseEntered(MouseEvent mouseEvent) { removeOntologyButton.setIcon(removeOntologyButtonIconOver); } @Override public void mouseExited(MouseEvent mouseEvent) { removeOntologyButton.setIcon(removeOntologyButtonIcon); } }); removeOntologyButton.setVisible(false); viewOntologyButton = new JLabel(browseOntologyButtonIcon); viewOntologyButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent mouseEvent) { performTransition(); viewOntologyButton.setIcon(browseOntologyButtonIcon); } @Override public void mouseEntered(MouseEvent mouseEvent) { viewOntologyButton.setIcon(browseOntologyButtonIconOver); } @Override public void mouseExited(MouseEvent mouseEvent) { viewOntologyButton.setIcon(browseOntologyButtonIcon); } }); viewOntologyButton.setVisible(false); removeRestrictionButton = new JLabel(removeRestrictionButtonIcon); removeRestrictionButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent mouseEvent) { if (!selectedOntologyList.isSelectionEmpty()) { ((RecommendedOntology) selectedOntologyList.getSelectedValue()).setBranchToSearchUnder(null); removeRestrictionButton.setVisible(false); selectedOntologyList.repaint(); } removeRestrictionButton.setIcon(removeRestrictionButtonIcon); } @Override public void mouseEntered(MouseEvent mouseEvent) { removeRestrictionButton.setIcon(removeRestrictionButtonIconOver); } @Override public void mouseExited(MouseEvent mouseEvent) { removeRestrictionButton.setIcon(removeRestrictionButtonIcon); } }); removeRestrictionButton.setVisible(false); Box selectedOntologiesOptionContainer = Box.createHorizontalBox(); selectedOntologiesOptionContainer.setOpaque(false); selectedOntologiesOptionContainer.add(removeOntologyButton); selectedOntologiesOptionContainer.add(viewOntologyButton); selectedOntologiesOptionContainer.add(removeRestrictionButton); selectedOntologiesContainer.add(selectedOntologiesOptionContainer, BorderLayout.SOUTH); // create panel populated with all available ontologies inside a filterable list! JPanel availableOntologiesListContainer = new JPanel(new BorderLayout()); availableOntologiesListContainer .setBorder(new TitledBorder(new RoundedBorder(UIHelper.LIGHT_GREEN_COLOR, 7), "available ontologies", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR)); final ExtendedJList availableOntologies = new ExtendedJList(listRenderer); final JLabel addOntologyButton = new JLabel(addOntologyButtonIcon); addOntologyButton.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent mouseEvent) { if (!availableOntologies.isSelectionEmpty()) { Ontology ontology = (Ontology) availableOntologies.getSelectedValue(); selectedOntologies.put(ontology.getOntologyDisplayLabel(), new RecommendedOntology(ontology)); updateSelectedOntologies(); setOntologySelectionPanelPlaceholder(infoImage); } addOntologyButton.setIcon(addOntologyButtonIcon); } @Override public void mouseEntered(MouseEvent mouseEvent) { addOntologyButton.setIcon(addOntologyButtonIconOver); } @Override public void mouseExited(MouseEvent mouseEvent) { addOntologyButton.setIcon(addOntologyButtonIcon); } }); final JLabel info = UIHelper.createLabel("", UIHelper.VER_10_PLAIN, UIHelper.DARK_GREEN_COLOR); availableOntologies.addPropertyChangeListener("update", new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { info.setText("<html>viewing <b>" + availableOntologies.getFilteredItems().size() + "</b> ontologies</html>"); } }); Box optionsBox = Box.createVerticalBox(); optionsBox.add(UIHelper.wrapComponentInPanel(info)); Box availableOntologiesOptionBox = Box.createHorizontalBox(); availableOntologiesOptionBox.add(addOntologyButton); availableOntologiesOptionBox.add(Box.createHorizontalGlue()); optionsBox.add(availableOntologiesOptionBox); availableOntologiesListContainer.add(optionsBox, BorderLayout.SOUTH); if (ontologiesToBrowseOn == null) { ontologiesToBrowseOn = new ArrayList<Ontology>(); List<Ontology> bioportalQueryResult = bioportalClient.getAllOntologies(); if (bioportalQueryResult != null) { ontologiesToBrowseOn.addAll(bioportalQueryResult); } ontologiesToBrowseOn.addAll(olsClient.getAllOntologies()); } // precautionary check in case of having no ontologies available to search on. if (ontologiesToBrowseOn != null) { for (Ontology o : ontologiesToBrowseOn) { availableOntologies.addItem(o); } } info.setText( "<html>viewing <b>" + availableOntologies.getFilteredItems().size() + "</b> ontologies</html>"); // need to get ontologies available from bioportal and add them here. JScrollPane availableOntologiesScroller = new JScrollPane(availableOntologies, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); availableOntologiesScroller.getViewport().setBackground(UIHelper.BG_COLOR); availableOntologiesScroller.setPreferredSize(new Dimension(200, 125)); availableOntologiesScroller.setBorder(new EmptyBorder(0, 0, 0, 0)); IAppWidgetFactory.makeIAppScrollPane(availableOntologiesScroller); availableOntologiesListContainer.add(availableOntologiesScroller); availableOntologiesListContainer.add(availableOntologies.getFilterField(), BorderLayout.NORTH); westPanel.add(selectedOntologiesContainer, BorderLayout.CENTER); westPanel.add(availableOntologiesListContainer, BorderLayout.SOUTH); add(westPanel, BorderLayout.WEST); }
From source file:org.jimcat.gui.perspective.boards.cards.Card.java
/** * build up swing componets// ww w. j a v a 2s . c o m */ 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.jimcat.gui.perspective.detail.DetailSideBar.java
/** * creates the preview head//w ww. jav a 2 s.co m * * @return the JPanel for preview purposes */ private JPanel createPreviewPanel() { // preview panel JPanel preview = new JPanel(); BorderLayout previewLayout = new BorderLayout(); previewLayout.setHgap(5); previewLayout.setVgap(5); preview.setLayout(new BorderLayout()); preview.setOpaque(true); image = new ImageViewer(); image.setMinimumSize(PREVIEW_DIMENSION); image.setPreferredSize(PREVIEW_DIMENSION); image.setMaximumSize(PREVIEW_DIMENSION); image.setBorder(new EmptyBorder(5, 5, 5, 5)); image.setOpaque(false); image.addMouseListener(new PreviewImageDoubleClickListener()); preview.add(image, BorderLayout.CENTER); return preview; }
From source file:org.jimcat.gui.perspective.detail.DetailSideBar.java
/** * creates image Detail - Section/*from ww w. ja va 2 s . co m*/ * * @return the Component used to show details */ private JComponent createImageDetail() { JLabel tmp = null; // Task Panel JXTaskPaneContainer container = new JXTaskPaneContainer(); container.setOpaque(false); // General Infos JXTaskPane general = new JXTaskPane(); general.setOpaque(true); general.setTitle("General Info"); general.setExpanded(true); // General info list JPanel info = new JPanel(); GridLayout infoLayout = new GridLayout(0, 2); infoLayout.setHgap(5); info.setLayout(infoLayout); info.setOpaque(false); tmp = new JLabel("Title"); tmp.setFont(labelFont); info.add(tmp); info.add(title); tmp = new JLabel("Rating"); tmp.setFont(labelFont); info.add(tmp); rating = new RatingEditor(); info.add(rating); tmp = new JLabel("Dimension"); tmp.setFont(labelFont); info.add(tmp); dimension = new JLabel(""); info.add(dimension); tmp = new JLabel("Size"); tmp.setFont(labelFont); info.add(tmp); size = new JLabel(""); info.add(size); tmp = new JLabel("Location"); tmp.setFont(labelFont); info.add(tmp); path = new JLabel(""); path.setToolTipText(""); info.add(path); general.add(info); container.add(general); // Exif data JXTaskPane exifs = new JXTaskPane(); exifs.setOpaque(true); exifs.setTitle("Exif Infos"); exifs.setExpanded(true); exifList = new ExifList(); exifs.add(exifList); container.add(exifs); // Tags JXTaskPane tags = new JXTaskPane(); tags.setOpaque(true); tags.setTitle("Associated Tags"); tags.setExpanded(true); // associated tags-list detailTagList = new DetailTagList(); tags.add(detailTagList); container.add(tags); // Modify Tags JXTaskPane filter = new JXTaskPane(); filter.setTitle("Modify Tags"); filter.setExpanded(false); filter.setOpaque(true); tagTree = new TagTree(); tagTree.addTagTreeListener(this); filter.setLayout(new BorderLayout()); filter.addMouseListener(new TagPanelPopupHandler(filter)); filter.add(tagTree, BorderLayout.CENTER); container.add(filter); JScrollPane pane = new JScrollPane(); pane.setOpaque(true); pane.setBorder(null); pane.setViewportView(container); pane.putClientProperty(SubstanceLookAndFeel.WATERMARK_TO_BLEED, Boolean.TRUE); return pane; }
From source file:org.languagetool.gui.Main.java
private void createGUI() { loadRecentFiles();/*www.j av a 2s. c o m*/ frame = new JFrame("LanguageTool " + JLanguageTool.VERSION); setLookAndFeel(); openAction = new OpenAction(); saveAction = new SaveAction(); saveAsAction = new SaveAsAction(); checkAction = new CheckAction(); autoCheckAction = new AutoCheckAction(true); showResultAction = new ShowResultAction(true); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new CloseListener()); URL iconUrl = JLanguageTool.getDataBroker().getFromResourceDirAsUrl(TRAY_ICON); frame.setIconImage(new ImageIcon(iconUrl).getImage()); textArea = new JTextArea(); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.addKeyListener(new ControlReturnTextCheckingListener()); textLineNumber = new TextLineNumber(textArea, 2); numberedTextAreaPane = new JScrollPane(textArea); numberedTextAreaPane.setRowHeaderView(textLineNumber); resultArea = new JTextPane(); undoRedo = new UndoRedoSupport(this.textArea, messages); frame.setJMenuBar(createMenuBar()); GridBagConstraints buttonCons = new GridBagConstraints(); JPanel insidePanel = new JPanel(); insidePanel.setOpaque(false); insidePanel.setLayout(new GridBagLayout()); buttonCons.gridx = 0; buttonCons.gridy = 0; buttonCons.anchor = GridBagConstraints.LINE_START; insidePanel.add(new JLabel(messages.getString("textLanguage") + " "), buttonCons); //create a ComboBox with flags, do not include hidden languages languageBox = LanguageComboBox.create(messages, EXTERNAL_LANGUAGE_SUFFIX, true, false); buttonCons.gridx = 1; buttonCons.gridy = 0; buttonCons.anchor = GridBagConstraints.LINE_START; insidePanel.add(languageBox, buttonCons); JCheckBox autoDetectBox = new JCheckBox(messages.getString("atd")); buttonCons.gridx = 2; buttonCons.gridy = 0; buttonCons.gridwidth = GridBagConstraints.REMAINDER; buttonCons.anchor = GridBagConstraints.LINE_START; insidePanel.add(autoDetectBox, buttonCons); buttonCons.gridx = 0; buttonCons.gridy = 1; buttonCons.gridwidth = GridBagConstraints.REMAINDER; buttonCons.fill = GridBagConstraints.HORIZONTAL; buttonCons.anchor = GridBagConstraints.LINE_END; buttonCons.weightx = 1.0; insidePanel.add(statusLabel, buttonCons); Container contentPane = frame.getContentPane(); GridBagLayout gridLayout = new GridBagLayout(); contentPane.setLayout(gridLayout); GridBagConstraints cons = new GridBagConstraints(); cons.gridx = 0; cons.gridy = 1; cons.fill = GridBagConstraints.HORIZONTAL; cons.anchor = GridBagConstraints.FIRST_LINE_START; JToolBar toolbar = new JToolBar("Toolbar", JToolBar.HORIZONTAL); toolbar.setFloatable(false); contentPane.add(toolbar, cons); JButton openButton = new JButton(openAction); openButton.setHideActionText(true); openButton.setFocusable(false); toolbar.add(openButton); JButton saveButton = new JButton(saveAction); saveButton.setHideActionText(true); saveButton.setFocusable(false); toolbar.add(saveButton); JButton saveAsButton = new JButton(saveAsAction); saveAsButton.setHideActionText(true); saveAsButton.setFocusable(false); toolbar.add(saveAsButton); JButton spellButton = new JButton(this.checkAction); spellButton.setHideActionText(true); spellButton.setFocusable(false); toolbar.add(spellButton); JToggleButton autoSpellButton = new JToggleButton(autoCheckAction); autoSpellButton.setHideActionText(true); autoSpellButton.setFocusable(false); toolbar.add(autoSpellButton); JButton clearTextButton = new JButton(new ClearTextAction()); clearTextButton.setHideActionText(true); clearTextButton.setFocusable(false); toolbar.add(clearTextButton); cons.insets = new Insets(5, 5, 5, 5); cons.fill = GridBagConstraints.BOTH; cons.weightx = 10.0f; cons.weighty = 10.0f; cons.gridx = 0; cons.gridy = 2; cons.weighty = 5.0f; splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, numberedTextAreaPane, new JScrollPane(resultArea)); mainPanel.setLayout(new GridLayout(0, 1)); contentPane.add(mainPanel, cons); mainPanel.add(splitPane); cons.fill = GridBagConstraints.HORIZONTAL; cons.gridx = 0; cons.gridy = 3; cons.weightx = 1.0f; cons.weighty = 0.0f; cons.insets = new Insets(4, 12, 4, 12); contentPane.add(insidePanel, cons); ltSupport = new LanguageToolSupport(this.frame, this.textArea, this.undoRedo); ResultAreaHelper.install(messages, ltSupport, resultArea); languageBox.selectLanguage(ltSupport.getLanguage()); languageBox.setEnabled(!ltSupport.getConfig().getAutoDetect()); autoDetectBox.setSelected(ltSupport.getConfig().getAutoDetect()); taggerShowsDisambigLog = ltSupport.getConfig().getTaggerShowsDisambigLog(); languageBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { // we cannot re-use the existing LT object anymore frame.applyComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault())); Language lang = languageBox.getSelectedLanguage(); ComponentOrientation componentOrientation = ComponentOrientation .getOrientation(lang.getLocale()); textArea.applyComponentOrientation(componentOrientation); resultArea.applyComponentOrientation(componentOrientation); ltSupport.setLanguage(lang); } } }); autoDetectBox.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { boolean selected = e.getStateChange() == ItemEvent.SELECTED; languageBox.setEnabled(!selected); ltSupport.getConfig().setAutoDetect(selected); if (selected) { Language detected = ltSupport.autoDetectLanguage(textArea.getText()); languageBox.selectLanguage(detected); } } }); ltSupport.addLanguageToolListener(new LanguageToolListener() { @Override public void languageToolEventOccurred(LanguageToolEvent event) { if (event.getType() == LanguageToolEvent.Type.CHECKING_STARTED) { String msg = org.languagetool.tools.Tools.i18n(messages, "checkStart"); statusLabel.setText(msg); if (event.getCaller() == getFrame()) { setWaitCursor(); checkAction.setEnabled(false); } } else if (event.getType() == LanguageToolEvent.Type.CHECKING_FINISHED) { if (event.getCaller() == getFrame()) { checkAction.setEnabled(true); unsetWaitCursor(); } String msg = org.languagetool.tools.Tools.i18n(messages, "checkDone", event.getSource().getMatches().size(), event.getElapsedTime()); statusLabel.setText(msg); } else if (event.getType() == LanguageToolEvent.Type.LANGUAGE_CHANGED) { languageBox.selectLanguage(ltSupport.getLanguage()); } else if (event.getType() == LanguageToolEvent.Type.RULE_ENABLED) { //this will trigger a check and the result will be updated by //the CHECKING_FINISHED event } else if (event.getType() == LanguageToolEvent.Type.RULE_DISABLED) { String msg = org.languagetool.tools.Tools.i18n(messages, "checkDoneNoTime", event.getSource().getMatches().size()); statusLabel.setText(msg); } } }); frame.applyComponentOrientation(ComponentOrientation.getOrientation(Locale.getDefault())); Language lang = ltSupport.getLanguage(); ComponentOrientation componentOrientation = ComponentOrientation.getOrientation(lang.getLocale()); textArea.applyComponentOrientation(componentOrientation); resultArea.applyComponentOrientation(componentOrientation); ResourceBundle textLanguageMessageBundle = JLanguageTool.getMessageBundle(ltSupport.getLanguage()); textArea.setText(textLanguageMessageBundle.getString("guiDemoText")); Configuration config = ltSupport.getConfig(); if (config.getFontName() != null || config.getFontStyle() != Configuration.FONT_STYLE_INVALID || config.getFontSize() != Configuration.FONT_SIZE_INVALID) { String fontName = config.getFontName(); if (fontName == null) { fontName = textArea.getFont().getFamily(); } int fontSize = config.getFontSize(); if (fontSize == Configuration.FONT_SIZE_INVALID) { fontSize = textArea.getFont().getSize(); } Font font = new Font(fontName, config.getFontStyle(), fontSize); textArea.setFont(font); } frame.pack(); frame.setSize(WINDOW_WIDTH, WINDOW_HEIGHT); frame.setLocationByPlatform(true); splitPane.setDividerLocation(200); MainWindowStateBean state = localStorage.loadProperty("gui.state", MainWindowStateBean.class); if (state != null) { if (state.getBounds() != null) { frame.setBounds(state.getBounds()); ResizeComponentListener.setBoundsProperty(frame, state.getBounds()); } if (state.getDividerLocation() != null) { splitPane.setDividerLocation(state.getDividerLocation()); } if (state.getState() != null) { frame.setExtendedState(state.getState()); } } ResizeComponentListener.attachToWindow(frame); maybeStartServer(); }
From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java
private void initUI() { setMinimumSize(new Dimension(550, 160)); setLayout(new BorderLayout()); setOpaque(true);/*from w ww . ja v a2 s . c o m*/ 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); }