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.ut.biolab.medsavant.client.project.ProjectSummaryPage.java
@Override public JPanel getView() { JPanel view = new JPanel(); ViewUtil.applyVerticalBoxLayout(view); //view.setLayout(new GridBagLayout()); JLabel title = new JLabel(ProjectController.getInstance().getCurrentProjectName() + " Project"); title.setBorder(ViewUtil.getBigBorder()); title.setOpaque(false); title.setFont(ViewUtil.getMediumTitleFont()); CollapsiblePanes panes = new CollapsiblePanes(); panes.add(createPatientSummary());// w w w .j a v a 2s . c o m panes.add(createVariantSummary()); panes.add(createReferenceSummary()); panes.addExpansion(); view.add(title); view.add(panes); return view; }
From source file:pl.otros.logview.gui.markers.editor.StringRegexMarkerEditor.java
public StringRegexMarkerEditor() { markersContainser = AllPluginables.getInstance().getMarkersContainser(); saveEnableListener = new SaveEnableListener(); chooser = new JFileChooser("./plugins/markers"); chooser.setMultiSelectionEnabled(false); fileFilterString = new MarkerFileFilter(); chooser.setFileFilter(fileFilterString); GridBagLayout bagLayout = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); this.setLayout(bagLayout); TestAfterChangeActionListener testAfterChangeActionListener = new TestAfterChangeActionListener(); loadButton = new JButton("Load"); loadButton.addActionListener(new LoadctionListener()); saveButton = new JButton("Save"); saveButton.addActionListener(new SaveActionListener()); saveAsButton = new JButton("Save as"); saveAsButton.addActionListener(new SaveAsActionListener()); newButton = new JButton("New"); newButton.addActionListener(new NewMarkerActionListener()); type = new JComboBox(new String[] { "String matcher", "Regex matcher" }); type.addActionListener(new ActionListener() { @Override/*ww w .j a v a 2 s.co m*/ public void actionPerformed(ActionEvent arg0) { if (type.getSelectedIndex() == 0) { preConditionLabel.setEnabled(false); preCondition.setEnabled(false); } else { preConditionLabel.setEnabled(true); preCondition.setEnabled(true); } } }); type.addActionListener(testAfterChangeActionListener); type.addActionListener(saveEnableListener); int testLines = 3; testFields = new JTextField[3]; testResults = new JLabel[3]; for (int i = 0; i < testLines; i++) { testFields[i] = new JTextField(20); testFields[i].getDocument().addDocumentListener(testAfterChangeActionListener); testResults[i] = new JLabel("?"); } file = new JTextField(20); file.setEditable(false); file.getDocument().addDocumentListener(saveEnableListener); name = new JTextField(20); description = new JTextField(20); condition = new JTextField(20); condition.getDocument().addDocumentListener(testAfterChangeActionListener); preCondition = new JTextField(20); preCondition.getDocument().addDocumentListener(testAfterChangeActionListener); ignoreCase = new JCheckBox(); ignoreCase.addActionListener(testAfterChangeActionListener); include = new JCheckBox(); include.addActionListener(testAfterChangeActionListener); groups = new JTextField(20); colors = new JComboBox(MarkerColors.values()); colors.setRenderer(new MarkerColorsComboBoxRenderer()); c.gridwidth = 1; c.insets = new Insets(4, 4, 4, 4); this.add(saveButton, c); c.gridx = 1; this.add(saveAsButton, c); c.gridy++; c.gridy++; c.gridx = 0; this.add(newButton, c); c.gridx = 1; this.add(loadButton, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("Type:"), type, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("File:"), file, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("Name:"), name, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("Description:"), description, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("Groups:"), groups, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("Condition:"), condition, c); c.gridy++; this.addFormLabelsLeftLong(preConditionLabel, preCondition, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("Ignore case:"), ignoreCase, c); c.gridy++; this.addFormLabelsLeftLong(includeLabel, include, c); c.gridy++; this.addFormLabelsLeftLong(new JLabel("Color"), colors, c); c.gridy++; this.addFormLabelsRightLong(new JLabel("Test lines"), new JLabel("Result"), c); c.gridy++; for (int i = 0; i < testLines; i++) { this.addFormLabelsRightLong(testFields[i], testResults[i], c); c.gridy++; } JLabel warningLabel = new JLabel("Warning, restart application to reload changes."); warningLabel.setForeground(Color.RED); warningLabel.setOpaque(false); c.gridx = 0; c.gridwidth = 3; this.add(warningLabel, c); type.setSelectedIndex(0); newMarker(); }
From source file:Proiect.uploadFTP.java
public void actionFTP() { adressf.addCaretListener(new CaretListener() { public void caretUpdate(CaretEvent e) { InetAddress thisIp;/* w w w . j a v a2s . com*/ try { thisIp = InetAddress.getLocalHost(); titleFTP.setText("Connection: " + thisIp.getHostAddress() + " -> " + adressf.getText()); } catch (UnknownHostException e1) { e1.printStackTrace(); } } }); exit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { saveState(); uploadFTP.dispose(); tree.dispose(); } }); connect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { FTPClient client = new FTPClient(); FileInputStream fis = null; String pass = String.valueOf(passf.getPassword()); try { if (filename == null) { status.setText("File does not exist!"); } else { // Server address client.connect(adressf.getText()); // Login credentials client.login(userf.getText(), pass); if (client.isConnected()) { status.setText("Succesfull transfer!"); // File type client.setFileType(FTP.BINARY_FILE_TYPE); // File location File file = new File(filepath); fis = new FileInputStream(file); // Change the folder on the server client.changeWorkingDirectory(folderf.getText()); // Save the file on the server client.storeFile(filename, fis); } else { status.setText("Transfer failed!"); } } client.logout(); } catch (IOException e1) { Encrypter.printException(e1); } finally { try { if (fis != null) { fis.close(); } client.disconnect(); } catch (IOException e1) { Encrypter.printException(e1); } } } }); browsef.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int retval = chooserf.showOpenDialog(chooserf); if (retval == JFileChooser.APPROVE_OPTION) { status.setText(""); filename = chooserf.getSelectedFile().getName().toString(); filepath = chooserf.getSelectedFile().getPath(); filenf.setText(chooserf.getSelectedFile().getName().toString()); } } }); adv.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tree.setSize(220, uploadFTP.getHeight()); tree.setLocation(uploadFTP.getX() + 405, uploadFTP.getY()); tree.setResizable(false); tree.setIconImage(Toolkit.getDefaultToolkit() .getImage(getClass().getClassLoader().getResource("assets/ico.png"))); tree.setUndecorated(true); tree.getRootPane().setBorder(BorderFactory.createLineBorder(Encrypter.color_black, 2)); tree.setVisible(true); tree.setLayout(new BorderLayout()); JLabel labeltree = new JLabel("Server documents"); labeltree.setOpaque(true); labeltree.setBackground(Encrypter.color_light); labeltree.setBorder(BorderFactory.createMatteBorder(8, 10, 10, 0, Encrypter.color_light)); labeltree.setForeground(Encrypter.color_blue); labeltree.setFont(Encrypter.font16); JButton refresh = new JButton(""); ImageIcon refresh_icon = getImageIcon("assets/icons/refresh.png"); refresh.setIcon(refresh_icon); refresh.setBackground(Encrypter.color_light); refresh.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0)); refresh.setForeground(Encrypter.color_black); refresh.setFont(Encrypter.font16); refresh.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); final FTPClient client = new FTPClient(); DefaultMutableTreeNode top = new DefaultMutableTreeNode(adressf.getText()); DefaultMutableTreeNode files = null; DefaultMutableTreeNode leaf = null; final JTree tree_view = new JTree(top); tree_view.setForeground(Encrypter.color_black); tree_view.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 0)); tree_view.putClientProperty("JTree.lineStyle", "None"); tree_view.setBackground(Encrypter.color_light); JScrollPane scrolltree = new JScrollPane(tree_view); scrolltree.setBackground(Encrypter.color_light); scrolltree.getVerticalScrollBar().setPreferredSize(new Dimension(0, 0)); UIManager.put("Tree.textBackground", Encrypter.color_light); UIManager.put("Tree.selectionBackground", Encrypter.color_blue); UIManager.put("Tree.selectionBorderColor", Encrypter.color_blue); tree_view.updateUI(); final String pass = String.valueOf(passf.getPassword()); try { client.connect(adressf.getText()); client.login(userf.getText(), pass); client.enterLocalPassiveMode(); if (client.isConnected()) { try { FTPFile[] ftpFiles = client.listFiles(); for (FTPFile ftpFile : ftpFiles) { files = new DefaultMutableTreeNode(ftpFile.getName()); top.add(files); if (ftpFile.getType() == FTPFile.DIRECTORY_TYPE) { FTPFile[] ftpFiles1 = client.listFiles(ftpFile.getName()); for (FTPFile ftpFile1 : ftpFiles1) { leaf = new DefaultMutableTreeNode(ftpFile1.getName()); files.add(leaf); } } } } catch (IOException e1) { Encrypter.printException(e1); } client.disconnect(); } else { status.setText("Failed connection!"); } } catch (IOException e1) { Encrypter.printException(e1); } finally { try { client.disconnect(); } catch (IOException e1) { Encrypter.printException(e1); } } tree.add(labeltree, BorderLayout.NORTH); tree.add(scrolltree, BorderLayout.CENTER); tree.add(refresh, BorderLayout.SOUTH); uploadFTP.addComponentListener(new ComponentListener() { public void componentMoved(ComponentEvent e) { tree.setLocation(uploadFTP.getX() + 405, uploadFTP.getY()); } public void componentShown(ComponentEvent e) { } public void componentResized(ComponentEvent e) { } public void componentHidden(ComponentEvent e) { } }); uploadFTP.addWindowListener(new WindowListener() { public void windowActivated(WindowEvent e) { tree.toFront(); } public void windowOpened(WindowEvent e) { } public void windowIconified(WindowEvent e) { } public void windowDeiconified(WindowEvent e) { } public void windowDeactivated(WindowEvent e) { } public void windowClosing(WindowEvent e) { } public void windowClosed(WindowEvent e) { } }); refresh.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { tree.dispose(); tree.setVisible(true); } }); } }); }
From source file:projectresurrection.Music.java
public void subMenu(int menu) { JPanel panel = (JPanel) ((JViewport) ((JScrollPane) pnlSub.getComponent(3)).getComponent(0)) .getComponent(0);//w w w .j a v a2s . c om JLabel header = (JLabel) pnlSub.getComponent(1); JLabel label; panel.removeAll(); int y = 10; switch (menu) { case 0: header.setText("Artists"); panel.setPreferredSize(new Dimension(349, (55 + (artists.size() * 35)))); label = new JLabel("All"); label.setOpaque(true); label.setBackground(new Color(245, 245, 245)); label.setFont(new Font("Tahoma", Font.PLAIN, 20)); label.setBounds(10, y, 339, 35); label.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { subMenu(ALBUMS); panel.revalidate(); panel.repaint(); } }); panel.add(label); y += 35; List artistList = new ArrayList(artists.keySet()); Collections.sort(artistList); for (int i = 0; i < artistList.size(); i++) { String artist = artistList.get(i).toString(); label = new JLabel(artist); label.setOpaque(true); if (i % 2 == 1) { label.setBackground(new Color(245, 245, 245)); } label.setFont(new Font("Tahoma", Font.PLAIN, 20)); label.setBounds(10, y, 339, 35); label.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { subMenu(ARTISTS, artist); panel.revalidate(); panel.repaint(); } }); panel.add(label); y += 35; } break; case 1: header.setText("Albums"); panel.setPreferredSize(new Dimension(349, (55 + (albums.size() * 35)))); label = new JLabel("All"); label.setOpaque(true); label.setBackground(new Color(245, 245, 245)); label.setFont(new Font("Tahoma", Font.PLAIN, 20)); label.setBounds(10, y, 339, 35); label.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { subMenu(SONGS); panel.revalidate(); panel.repaint(); } }); panel.add(label); y += 35; List albumList = new ArrayList(albums.keySet()); Collections.sort(albumList); for (int i = 0; i < albumList.size(); i++) { String album = albumList.get(i).toString(); label = new JLabel(album); label.setOpaque(true); if (i % 2 == 1) { label.setBackground(new Color(245, 245, 245)); } label.setFont(new Font("Tahoma", Font.PLAIN, 20)); label.setBounds(10, y, 339, 35); label.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { subMenu(ALBUMS, album); panel.revalidate(); panel.repaint(); } }); panel.add(label); y += 35; } break; case 2: header.setText("Songs"); panel.setPreferredSize(new Dimension(349, (20 + (songs.size() * 35)))); List songList = new ArrayList(songs.keySet()); Collections.sort(songList); List fileList = new ArrayList(); for (int i = 0; i < songList.size(); i++) { fileList.add(((List) songs.get(songList.get(i))).get(0)); } for (int i = 0; i < songList.size(); i++) { int num = i; String song = songList.get(i).toString(); label = new JLabel(song); label.setOpaque(true); if (i % 2 == 0) { label.setBackground(new Color(245, 245, 245)); } label.setFont(new Font("Tahoma", Font.PLAIN, 20)); label.setBounds(10, y, 339, 35); label.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { player.setPlaylist(fileList, num); pnlSub.setVisible(false); pnlPlayer.setVisible(true); try { Thread.sleep(200); } catch (Exception e) { } if (player.isPlaying() == false) { player.toggle(); } } }); panel.add(label); y += 35; } break; } pnlMenu.setVisible(false); pnlSub.setVisible(true); }
From source file:projectresurrection.Music.java
public void subMenu(int type, String menu) { JPanel panel = (JPanel) ((JViewport) ((JScrollPane) pnlSub.getComponent(3)).getComponent(0)) .getComponent(0);//from w w w. j a v a 2 s. co m JLabel header = (JLabel) pnlSub.getComponent(1); JLabel label; header.setText(menu); panel.removeAll(); int y = 10; switch (type) { case 0: List albumList = new ArrayList(((Map) artists.get(menu)).keySet()); Collections.sort(albumList); panel.setPreferredSize(new Dimension(349, (55 + (albumList.size() * 35)))); label = new JLabel("All"); label.setOpaque(true); label.setBackground(new Color(245, 245, 245)); label.setFont(new Font("Tahoma", Font.PLAIN, 20)); label.setBounds(10, y, 339, 35); label.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { subMenuAll(ARTISTS, menu); panel.revalidate(); panel.repaint(); } }); panel.add(label); y += 35; for (int i = 0; i < albumList.size(); i++) { String album = albumList.get(i).toString(); label = new JLabel(album); label.setOpaque(true); if (i % 2 == 1) { label.setBackground(new Color(245, 245, 245)); } label.setFont(new Font("Tahoma", Font.PLAIN, 20)); label.setBounds(10, y, 339, 35); label.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { subMenu(ALBUMS, album); panel.revalidate(); panel.repaint(); } }); panel.add(label); y += 35; } break; case 1: List songList = new ArrayList(); List albumSongs = new ArrayList(((Map) albums.get(menu)).keySet()); Collections.sort(albumSongs); Map tracks = new HashMap(); for (int i = 0; i < albumSongs.size(); i++) { String track = ((List) songs.get(albumSongs.get(i))).get(1).toString(); if (tracks.containsKey(track)) { track = track + "(1)"; int j = 2; while (tracks.containsKey(track)) { track = track + "(" + j + ")"; } } tracks.put(track, albumSongs.get(i)); } List nums = new ArrayList(tracks.keySet()); Collections.sort(nums); List hasTrack = new ArrayList(); List noTrack = new ArrayList(); for (int i = 0; i < nums.size(); i++) { if (nums.get(i).equals("-1")) { noTrack.add(tracks.get(nums.get(i))); } else { hasTrack.add(tracks.get(nums.get(i))); } } Collections.sort(noTrack); for (int i = 0; i < hasTrack.size(); i++) { songList.add(hasTrack.get(i)); } for (int i = 0; i < noTrack.size(); i++) { songList.add(noTrack.get(i)); } panel.setPreferredSize(new Dimension(349, (20 + (albumSongs.size() * 35)))); List fileList = new ArrayList(); for (int i = 0; i < songList.size(); i++) { fileList.add(((List) songs.get(songList.get(i))).get(0)); } for (int i = 0; i < songList.size(); i++) { int num = i; String song = songList.get(i).toString(); label = new JLabel(song); label.setOpaque(true); if (i % 2 == 0) { label.setBackground(new Color(245, 245, 245)); } label.setFont(new Font("Tahoma", Font.PLAIN, 20)); label.setBounds(10, y, 339, 35); label.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { player.setPlaylist(fileList, num); pnlSub.setVisible(false); pnlPlayer.setVisible(true); try { Thread.sleep(200); } catch (Exception e) { } if (player.isPlaying() == false) { player.toggle(); } } }); panel.add(label); y += 35; } break; } panel.revalidate(); panel.repaint(); }
From source file:projectresurrection.Music.java
public void subMenuAll(int type, String menu) { JPanel panel = (JPanel) ((JViewport) ((JScrollPane) pnlSub.getComponent(3)).getComponent(0)) .getComponent(0);//from ww w .j av a2 s. co m JLabel header = (JLabel) pnlSub.getComponent(1); header.setText(menu + " - All"); panel.removeAll(); int y = 10; switch (type) { case 0: List songList = new ArrayList(); List albumList = new ArrayList(((Map) artists.get(menu)).keySet()); Collections.sort(albumList); for (int i = 0; i < albumList.size(); i++) { List albumSongs = new ArrayList(((Map) albums.get(albumList.get(i))).keySet()); Map tracks = new HashMap(); for (int j = 0; j < albumSongs.size(); j++) { String track = ((List) songs.get(albumSongs.get(j))).get(1).toString(); tracks.put(track, albumSongs.get(j)); } List nums = new ArrayList(tracks.keySet()); Collections.sort(nums); List hasTrack = new ArrayList(); List noTrack = new ArrayList(); for (int j = 0; j < nums.size(); j++) { if (nums.get(j).equals("-1")) { noTrack.add(tracks.get(nums.get(j))); } else { hasTrack.add(tracks.get(nums.get(j))); } } for (int j = 0; j < hasTrack.size(); j++) { songList.add(hasTrack.get(j)); } for (int j = 0; j < noTrack.size(); j++) { songList.add(noTrack.get(j)); } } panel.setPreferredSize(new Dimension(349, (20 + (songList.size() * 35)))); List fileList = new ArrayList(); for (int i = 0; i < songList.size(); i++) { fileList.add(((List) songs.get(songList.get(i))).get(0)); } for (int i = 0; i < songList.size(); i++) { int num = i; String song = songList.get(i).toString(); JLabel label = new JLabel(song); label.setOpaque(true); if (i % 2 == 0) { label.setBackground(new Color(245, 245, 245)); } label.setFont(new Font("Tahoma", Font.PLAIN, 20)); label.setBounds(10, y, 339, 35); label.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { player.setPlaylist(fileList, num); pnlSub.setVisible(false); pnlPlayer.setVisible(true); try { Thread.sleep(200); } catch (Exception e) { } if (player.isPlaying() == false) { player.toggle(); } } }); panel.add(label); y += 35; } break; } panel.revalidate(); panel.repaint(); }
From source file:savant.amino.AminoPlugin.java
/** * Create the user-interface which appears within the panel. * * @param panel provided by Savant/*w ww. jav a2 s.co m*/ */ @Override public void init(JPanel panel) { panel.setLayout(new GridLayout(5, 4, 2, 2)); // Create a label for each amino-acid. For now, these are just for reference, // but we might make them into buttons to change the colour scheme. for (AminoAcid a : AminoAcid.values()) { JLabel label = new JLabel(a.name, SwingConstants.CENTER); label.setOpaque(true); label.setBackground(a.color); label.setForeground(a == AminoAcid.STOP ? Color.WHITE : Color.BLACK); panel.add(label); } // First time through, create canvasses for any existing gene tracks. We // hook this onto a listener so that we'll know that Savant has fully loaded // the plugin before we try to do anything. PluginUtils.addPluginListener(new Listener<PluginEvent>() { @Override public void handleEvent(PluginEvent event) { if (event.getType() == PluginEvent.Type.LOADED && event.getPlugin() instanceof AminoPlugin) { PluginUtils.removePluginListener(this); TrackAdapter[] existingTracks = TrackUtils.getTracks(DataFormat.RICH_INTERVAL); for (TrackAdapter t : existingTracks) { createCanvas(t); } } } }); TrackUtils.addTrackListener(new Listener<TrackEvent>() { @Override public void handleEvent(TrackEvent event) { if (event.getType() == TrackEvent.Type.ADDED) { createCanvas(event.getTrack()); } } }); NavigationUtils.addLocationChangedListener(new Listener<LocationChangedEvent>() { @Override public void handleEvent(LocationChangedEvent event) { for (TrackAdapter t : TrackUtils.getTracks()) { if (t.getDataFormat() == DataFormat.RICH_INTERVAL) { t.getLayerCanvas(AminoPlugin.this).repaint(); } } } }); }
From source file:semgen.extraction.RadialGraph.Clusterer.java
public String clusterAndRecolor(AggregateLayout<String, Number> layout, int numEdgesToRemove, Color[] colors, boolean groupClusters) { setCursor(new Cursor(Cursor.WAIT_CURSOR)); String moduletable = ""; Graph<String, Number> g = layout.getGraph(); layout.removeAll();/*from ww w. java 2s. c om*/ EdgeBetweennessClusterer<String, Number> clusterer = new EdgeBetweennessClusterer<String, Number>( numEdgesToRemove); Set<Set<String>> clusterSet = clusterer.transform(g); List<Number> edges = clusterer.getEdgesRemoved(); sempanel.removeAll(); int i = 0; // Set the colors of each node so that each cluster's vertices have the same color extractor.clusterpanel.checkboxpanel.removeAll(); for (Iterator<Set<String>> cIt = clusterSet.iterator(); cIt.hasNext();) { moduletable = moduletable + "\nCLUSTER " + (i + 1); Set<String> vertices = cIt.next(); Color c = colors[i % colors.length]; Set<DataStructure> datastrs = new HashSet<DataStructure>(); for (String vertex : vertices) { datastrs.add(extractor.semsimmodel.getDataStructure(vertex)); } JLabel modulelabel = new JLabel("Cluster " + (i + 1)); modulelabel.setOpaque(true); modulelabel.setFont(SemGenFont.defaultBold()); modulelabel.setBackground(c); modulelabel.setAlignmentX(LEFT_ALIGNMENT); sempanel.add(modulelabel); // Update the semantics panel Set<String> addedterms = new HashSet<String>(); for (String ver : vertices) { if (extractor.semsimmodel.getDataStructure(ver).hasPhysicalProperty()) { if (extractor.semsimmodel.getDataStructure(ver).getPhysicalProperty() .getPhysicalPropertyOf() != null) { PhysicalModelComponent pmc = extractor.semsimmodel.getDataStructure(ver) .getPhysicalProperty().getPhysicalPropertyOf(); String name = null; if (pmc.hasRefersToAnnotation()) { name = pmc.getFirstRefersToReferenceOntologyAnnotation().getValueDescription(); } else { name = pmc.getName(); } if (!addedterms.contains(name)) { addedterms.add(name); JTextArea enttext = new JTextArea(name); enttext.setOpaque(true); enttext.setBackground(c); enttext.setFont(SemGenFont.defaultPlain(-2)); if (pmc instanceof PhysicalProcess) { enttext.setFont(SemGenFont.defaultItalic(-2)); name = "Process: " + name; } else name = "Entity: " + name; enttext.setWrapStyleWord(true); enttext.setLineWrap(true); enttext.setBorder(BorderFactory.createEmptyBorder(7, 7, 0, 0)); enttext.setAlignmentX(LEFT_ALIGNMENT); sempanel.add(enttext); moduletable = moduletable + "\n " + name; } } } } sempanel.validate(); sempanel.repaint(); semscroller.repaint(); semscroller.validate(); this.repaint(); this.validate(); colorCluster(vertices, c); ExtractorJCheckBox box = new ExtractorJCheckBox("Cluster " + (i + 1), datastrs); box.setBackground(c); box.setOpaque(true); box.addItemListener(extractor); extractor.clusterpanel.checkboxpanel.add(box); if (groupClusters == true) groupCluster(layout, vertices); i++; } refreshModulePanel(); for (Number e : g.getEdges()) { if (edges.contains(e)) edgePaints.put(e, Color.lightGray); else edgePaints.put(e, Color.black); } nummodules = i; setCursor(new Cursor(Cursor.DEFAULT_CURSOR)); return moduletable; }
From source file:uk.nhs.cfh.dsp.srth.desktop.uiframework.app.impl.ModularApplicationAboutDialog.java
/** * Inits the components.//from w w w. jav a 2 s . c om */ public void initComponents() { // initialise gui mainPanel = new JPanel(); JLabel logoLabel = new JLabel(); logoLabel.setIcon(ImageUtils.getIcon(ImageUtils.IconName.LOGO_WHITE)); logoLabel.setBackground(Color.WHITE); logoLabel.setOpaque(true); infoPane = new JTextPane(); infoPane.setEditorKit(new HTMLEditorKit()); infoPane.setText(createHTMLText()); infoPane.setEditable(false); mainPanel.setLayout(new BorderLayout()); mainPanel.add(logoLabel, BorderLayout.NORTH); mainPanel.add(new JScrollPane(infoPane), BorderLayout.CENTER); createButtonsPanel(); getContentPane().add(mainPanel); setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); setPreferredSize(new Dimension(400, 500)); setResizable(true); }
From source file:uk.nhs.cfh.dsp.yasb.searchpanel.renderer.SearchResultListCellRenderer.java
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean hasFocus) { JLabel label = new JLabel(); label.setOpaque(true); if (value instanceof Document) { // get field that has value of the fully specified name Document doc = (Document) value; if (isRenderConceptId()) { label.setText("<html><b>" + doc.get("TERM") + "</b><font color=\"eee\">|" + doc.get("CONCEPTID") + "|</font></html>"); } else {/*ww w . j a va 2 s. c o m*/ label.setText("<html><b>" + doc.get("TERM") + "</b></html>"); } // set icon based on status String status = doc.get("STATUS"); if ("limited".equalsIgnoreCase(status)) { label.setIcon(limitedStatusIcon); } else if ("duplicate".equalsIgnoreCase(status)) { label.setIcon(duplicateStatusIcon); } else if ("ambiguous".equalsIgnoreCase(status)) { label.setIcon(ambiguousStatusIcon); } else { label.setIcon(currentStatusIcon); } // always set tooltip to FSN + concept id label.setToolTipText("<html><b>" + doc.get("TERM") + "</b><font color=\"eee\">|" + doc.get("CONCEPTID") + "|</font></html>"); } if (isSelected) { label.setBackground(UIManager.getColor("Tree.selectionbackground")); } else { label.setBackground(UIManager.getColor("Tree.background")); } return label; }