List of usage examples for javax.swing UIManager getIcon
public static Icon getIcon(Object key)
Icon
from the defaults. From source file:de.codesourcery.eve.skills.ui.utils.PersistentDialogManager.java
protected static Icon getMessageIcon() { return UIManager.getIcon("OptionPane.informationIcon"); }
From source file:au.org.ala.delta.intkey.ui.CharacterImageDialog.java
private void init(List<Character> characters, Character dependentCharacter, boolean valuesEditable) { ResourceMap resourceMap = Application.getInstance().getContext().getResourceMap(CharacterImageDialog.class); resourceMap.injectFields(this); _characters = characters;/*from w w w . ja v a2 s .c o m*/ _valuesEditable = valuesEditable; getContentPane().setLayout(new BorderLayout(0, 0)); buildMenuItems(); if (dependentCharacter != null) { if (characters.size() != 1) { throw new IllegalArgumentException( "Dependent character should only be supplied if there is a single character being viewed in the dialog"); } Character ch = characters.get(0); _pnlControllingCharacterMessage = new JPanel(); _pnlControllingCharacterMessage.setFocusable(false); _pnlControllingCharacterMessage.setBorder(new EmptyBorder(5, 0, 0, 0)); getContentPane().add(_pnlControllingCharacterMessage, BorderLayout.NORTH); _pnlControllingCharacterMessage.setLayout(new BorderLayout(0, 0)); _lblWarningIcon = new JLabel(""); _lblWarningIcon.setFocusable(false); _lblWarningIcon.setIcon(UIManager.getIcon("OptionPane.warningIcon")); _pnlControllingCharacterMessage.add(_lblWarningIcon, BorderLayout.WEST); _txtControllingCharacterMessage = new JTextArea(); CharacterFormatter formatter = new CharacterFormatter(true, CommentStrippingMode.RETAIN, AngleBracketHandlingMode.REMOVE_SURROUNDING_REPLACE_INNER, true, false); String setControllingCharacterMessage = UIUtils.getResourceString( "MultiStateInputDialog.setControllingCharacterMessage", formatter.formatCharacterDescription(dependentCharacter), formatter.formatCharacterDescription(ch)); _txtControllingCharacterMessage.setText(setControllingCharacterMessage); _txtControllingCharacterMessage.setFocusable(false); _txtControllingCharacterMessage.setBorder(new EmptyBorder(0, 5, 0, 0)); _txtControllingCharacterMessage.setEditable(false); _pnlControllingCharacterMessage.add(_txtControllingCharacterMessage); _txtControllingCharacterMessage.setWrapStyleWord(true); _txtControllingCharacterMessage.setFont(UIManager.getFont("Button.font")); _txtControllingCharacterMessage.setLineWrap(true); _txtControllingCharacterMessage.setBackground(SystemColor.control); } }
From source file:imageviewer.system.ImageViewerClient.java
private void initialize(CommandLine args) { // First, process all the different command line arguments that we // need to override and/or send onwards for initialization. boolean fullScreen = (args.hasOption("fullscreen")) ? true : false; String dir = (args.hasOption("dir")) ? args.getOptionValue("dir") : null; String type = (args.hasOption("type")) ? args.getOptionValue("type") : "DICOM"; String prefix = (args.hasOption("client")) ? args.getOptionValue("client") : null; LOG.info("Java home environment: " + System.getProperty("java.home")); // Logging system taken care of through properties file. Check // for JAI. Set up JAI accordingly with the size of the cache // tile and to recycle cached tiles as needed. verifyJAI();/* w w w. ja v a 2s.c om*/ TileCache tc = JAI.getDefaultInstance().getTileCache(); tc.setMemoryCapacity(32 * 1024 * 1024); TileScheduler ts = JAI.createTileScheduler(); ts.setPriority(Thread.MAX_PRIORITY); JAI.getDefaultInstance().setTileScheduler(ts); JAI.getDefaultInstance().setRenderingHint(JAI.KEY_CACHED_TILE_RECYCLING_ENABLED, Boolean.TRUE); // Set up the frame and everything else. First, try and set the // UI manager to use our look and feel because it's groovy and // lets us control the GUI components much better. try { UIManager.setLookAndFeel(new ImageViewerLookAndFeel()); LookAndFeelAddons.setAddon(ImageViewerLookAndFeelAddons.class); } catch (Exception exc) { LOG.error("Could not set imageViewer L&F."); } // Load up the ApplicationContext information... ApplicationContext ac = ApplicationContext.getContext(); if (ac == null) { LOG.error("Could not load configuration, exiting."); System.exit(1); } // Override the client node information based on command line // arguments...Make sure that the files are there, otherwise just // default to a local configuration. String hostname = new String("localhost"); try { hostname = InetAddress.getLocalHost().getHostName(); } catch (Exception exc) { } String[] gatewayConfigs = (prefix != null) ? (new String[] { "resources/server/" + prefix + "GatewayConfig.xml", (String) ac.getProperty(ApplicationContext.IMAGESERVER_GATEWAY_CONFIG), "resources/server/" + hostname + "GatewayConfig.xml", "resources/server/localGatewayConfig.xml" }) : (new String[] { (String) ac.getProperty(ApplicationContext.IMAGESERVER_GATEWAY_CONFIG), "resources/server/" + hostname + "GatewayConfig.xml", "resources/server/localGatewayConfig.xml" }); String[] nodeConfigs = (prefix != null) ? (new String[] { "resources/server/" + prefix + "NodeConfig.xml", (String) ac.getProperty(ApplicationContext.IMAGESERVER_CLIENT_NODE), "resources/server/" + hostname + "NodeConfig.xml", "resources/server/localNodeConfig.xml" }) : (new String[] { (String) ac.getProperty(ApplicationContext.IMAGESERVER_CLIENT_NODE), "resources/server/" + hostname + "NodeConfig.xml", "resources/server/localNodeConfig.xml" }); for (int loop = 0; loop < gatewayConfigs.length; loop++) { String s = gatewayConfigs[loop]; if ((s != null) && (s.length() != 0) && (!"null".equals(s))) { File f = new File(s); if (f.exists()) { ac.setProperty(ApplicationContext.IMAGESERVER_GATEWAY_CONFIG, s); break; } } } LOG.info("Using gateway config: " + ac.getProperty(ApplicationContext.IMAGESERVER_GATEWAY_CONFIG)); for (int loop = 0; loop < nodeConfigs.length; loop++) { String s = nodeConfigs[loop]; if ((s != null) && (s.length() != 0) && (!"null".equals(s))) { File f = new File(s); if (f.exists()) { ac.setProperty(ApplicationContext.IMAGESERVER_CLIENT_NODE, s); break; } } } LOG.info("Using client config: " + ac.getProperty(ApplicationContext.IMAGESERVER_CLIENT_NODE)); // Load the layouts and set the default window/level manager... LayoutFactory.initialize(); DefaultWindowLevelManager dwlm = new DefaultWindowLevelManager(); // Create the main JFrame, set its behavior, and let the // ApplicationPanel know the glassPane and layeredPane. Set the // menubar based on reading in the configuration menus. mainFrame = new JFrame("imageviewer"); try { ArrayList<Image> iconList = new ArrayList<Image>(); iconList.add(ImageIO.read(new File("resources/icons/mii.png"))); iconList.add(ImageIO.read(new File("resources/icons/mii32.png"))); mainFrame.setIconImages(iconList); } catch (Exception exc) { } mainFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); mainFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { int confirm = ApplicationPanel.getInstance().showDialog( "Are you sure you want to quit imageViewer?", null, JOptionPane.QUESTION_MESSAGE, JOptionPane.OK_CANCEL_OPTION, UIManager.getIcon("Dialog.shutdownIcon")); if (confirm == JOptionPane.OK_OPTION) { boolean hasUnsaved = SaveStack.getInstance().hasUnsavedItems(); if (hasUnsaved) { int saveResult = ApplicationPanel.getInstance().showDialog( "There is still unsaved data. Do you want to save this data in the local archive?", null, JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_CANCEL_OPTION); if (saveResult == JOptionPane.CANCEL_OPTION) return; if (saveResult == JOptionPane.YES_OPTION) SaveStack.getInstance().saveAll(); } LOG.info("Shutting down imageServer local archive..."); try { ImageViewerClientNode.getInstance().shutdown(); } catch (Exception exc) { LOG.error("Problem shutting down imageServer local archive..."); } finally { System.exit(0); } } } }); String menuFile = (String) ApplicationContext.getContext().getProperty(ac.CONFIG_MENUS); String ribbonFile = (String) ApplicationContext.getContext().getProperty(ac.CONFIG_RIBBON); if (menuFile != null) { JMenuBar mb = new JMenuBar(); mb.setBackground(Color.black); MenuReader.parseFile(menuFile, mb); mainFrame.setJMenuBar(mb); ApplicationContext.getContext().setApplicationMenuBar(mb); } else if (ribbonFile != null) { RibbonReader rr = new RibbonReader(); JRibbon jr = rr.parseFile(ribbonFile); mainFrame.getContentPane().add(jr, BorderLayout.NORTH); ApplicationContext.getContext().setApplicationRibbon(jr); } mainFrame.getContentPane().add(ApplicationPanel.getInstance(), BorderLayout.CENTER); ApplicationPanel.getInstance().setGlassPane((JPanel) (mainFrame.getGlassPane())); ApplicationPanel.getInstance().setLayeredPane(mainFrame.getLayeredPane()); // Load specified plugins...has to occur after the menus are // created, btw. PluginLoader.initialize("config/plugins.xml"); // Detect operating system... String osName = System.getProperty("os.name"); ApplicationContext.getContext().setProperty(ApplicationContext.OS_NAME, osName); LOG.info("Detected operating system: " + osName); // Try and hack the searched library paths if it's windows so we // can add a local dll path... try { if (osName.contains("Windows")) { Field f = ClassLoader.class.getDeclaredField("usr_paths"); f.setAccessible(true); String[] paths = (String[]) f.get(null); String[] tmp = new String[paths.length + 1]; System.arraycopy(paths, 0, tmp, 0, paths.length); File currentPath = new File("."); tmp[paths.length] = currentPath.getCanonicalPath() + "/lib/dll/"; f.set(null, tmp); f.setAccessible(false); } } catch (Exception exc) { LOG.error("Error attempting to dynamically set library paths."); } // Get screen resolution... GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice() .getDefaultConfiguration(); Rectangle r = gc.getBounds(); LOG.info("Detected screen resolution: " + (int) r.getWidth() + "x" + (int) r.getHeight()); // Try and see if Java3D is installed, and if so, what version... try { VirtualUniverse vu = new VirtualUniverse(); Map m = vu.getProperties(); String s = (String) m.get("j3d.version"); LOG.info("Detected Java3D version: " + s); } catch (Throwable t) { LOG.info("Unable to detect Java3D installation"); } // Try and see if native JOGL is installed... try { System.loadLibrary("jogl"); ac.setProperty(ApplicationContext.JOGL_DETECTED, Boolean.TRUE); LOG.info("Detected native libraries for JOGL"); } catch (Throwable t) { LOG.info("Unable to detect native JOGL installation"); ac.setProperty(ApplicationContext.JOGL_DETECTED, Boolean.FALSE); } // Start the local client node to connect to the network and the // local archive running on this machine...Thread the connection // process so it doesn't block the imageViewerClient creating this // instance. We may not be connected to the given gateway, so the // socketServer may go blah... final boolean useNetwork = (args.hasOption("nonet")) ? false : true; ApplicationPanel.getInstance().addStatusMessage("ImageViewer is starting up, please wait..."); if (useNetwork) LOG.info("Starting imageServer client to join network - please wait..."); Thread t = new Thread(new Runnable() { public void run() { try { ImageViewerClientNode.getInstance( (String) ApplicationContext.getContext() .getProperty(ApplicationContext.IMAGESERVER_GATEWAY_CONFIG), (String) ApplicationContext.getContext() .getProperty(ApplicationContext.IMAGESERVER_CLIENT_NODE), useNetwork); ApplicationPanel.getInstance().addStatusMessage("Ready"); } catch (Exception exc) { exc.printStackTrace(); } } }); t.setPriority(9); t.start(); this.fullScreen = fullScreen; mainFrame.setUndecorated(fullScreen); // Set the view to encompass the default screen. if (fullScreen) { Insets i = Toolkit.getDefaultToolkit().getScreenInsets(gc); mainFrame.setLocation(r.x + i.left, r.y + i.top); mainFrame.setSize(r.width - i.left - i.right, r.height - i.top - i.bottom); } else { mainFrame.setSize(1100, 800); mainFrame.setLocation(r.x + 200, r.y + 100); } if (dir != null) ApplicationPanel.getInstance().load(dir, type); timer = new Timer(); timer.schedule(new GarbageCollectionTimer(), 5000, 2500); mainFrame.setVisible(true); }
From source file:com.sshtools.sshvnc.SshVNCPanel.java
public void init(SshToolsApplication application) throws SshToolsApplicationException {/*from ww w . j ava 2 s .c o m*/ super.init(application); setLayout(new BorderLayout()); sendTimer = new javax.swing.Timer(500, this); sendTimer.setRepeats(false); receiveTimer = new javax.swing.Timer(500, this); receiveTimer.setRepeats(false); statusBar = new StatusBar(); statusBar.setUser(""); statusBar.setHost(""); statusBar.setStatusText("Disconnected"); statusBar.setConnected(false); setLayout(new BorderLayout()); // Create our terminal emulation object try { emulation = createEmulation(); } catch (IOException ioe) { throw new SshToolsApplicationException(ioe); } // Set a scrollbar for the terminal - doesn't seem to be as simple as this emulation.setBufferSize(1000); // Create our swing terminal and add it to the main frame terminal = new TerminalPanel(emulation); terminal.requestFocus(); // try { vnc = new SshVNCViewer(); // Additional connection tabs additionalTabs = new SshToolsConnectionTab[] { new VNCTab( /*vnc*/), new VNCAdvancedTab( /*vnc*/) }; add(vnc, BorderLayout.CENTER); initActions(); } catch (Throwable t) { StringWriter sw = new StringWriter(); t.printStackTrace(new PrintWriter(sw)); IconWrapperPanel p = new IconWrapperPanel( UIManager.getIcon("OptionPane.errorIcon"), new ErrorTextBox( ((t.getMessage() == null) ? "<no message supplied>" : t.getMessage()) + (debug ? ("\n\n" + sw.getBuffer().toString()) : ""))); p.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); add(p, BorderLayout.CENTER); throw new SshToolsApplicationException( "Failed to start SshVNC. ", t); } }
From source file:com.sshtools.common.ui.SshToolsApplicationClientPanel.java
/** * * * @param f/*from ww w . j a v a2 s . c o m*/ */ public void open(File f) { log.debug("Opening connection file " + f); // Make sure a connection is not already open if (isConnected()) { Option optNew = new Option("New", "New create a new window", 'n'); Option optClose = new Option("Close", "Close current connection", 'l'); Option optCancel = new Option("Cancel", "Cancel the opening of this connection", 'c'); OptionsDialog dialog = OptionsDialog.createOptionDialog(this, new Option[] { optNew, optClose, optCancel }, "You already have a connection open. Select\n" + "Close to close the current connection, New\n" + "to create a new terminal or Cancel to abort.", "Existing connection", optNew, null, UIManager.getIcon("OptionPane.warningIcon")); UIUtil.positionComponent(SwingConstants.CENTER, dialog); dialog.setVisible(true); Option opt = dialog.getSelectedOption(); if ((opt == null) || (opt == optCancel)) { return; } else if (opt == optNew) { try { SshToolsApplicationContainer c = (SshToolsApplicationContainer) application.newContainer(); ((SshToolsApplicationClientPanel) c.getApplicationPanel()).open(f); return; } catch (SshToolsApplicationException stae) { log.error(stae); } } else { closeConnection(true); } } // Save to MRU if (getApplication().getMRUModel() != null) { getApplication().getMRUModel().add(f); } // Make sure its not invalid if (f != null) { // Create a new connection properties object SshToolsConnectionProfile profile = new SshToolsConnectionProfile(); try { // Open the file profile.open(f.getAbsolutePath()); setNeedSave(false); currentConnectionFile = f; //setContainerTitle(f); // Connect with the new details. connect(profile, false); } catch (InvalidProfileFileException fnfe) { showExceptionMessage(fnfe.getMessage(), "Open Connection"); } catch (SshException e) { e.printStackTrace(); showExceptionMessage("An unexpected error occured!", "Open Connection"); } } else { showExceptionMessage("Invalid file specified", "Open Connection"); } }
From source file:com.sshtools.powervnc.PowerVNCPanel.java
public void init(SshToolsApplication application) throws SshToolsApplicationException { System.out.println("init"); super.init(application); setLayout(new BorderLayout()); sendTimer = new javax.swing.Timer(500, this); sendTimer.setRepeats(false);//from w ww . j a v a2s .com receiveTimer = new javax.swing.Timer(500, this); receiveTimer.setRepeats(false); statusBar = new StatusBar(); statusBar.setUser(""); statusBar.setHost(""); statusBar.setStatusText("Disconnected"); statusBar.setConnected(false); setLayout(new BorderLayout()); // Create our terminal emulation object try { emulation = createEmulation(); } catch (IOException ioe) { throw new SshToolsApplicationException(ioe); } // Set a scrollbar for the terminal - doesn't seem to be as simple as this emulation.setBufferSize(1000); // Create our swing terminal and add it to the main frame terminal = new TerminalPanel(emulation); terminal.requestFocus(); // try { vnc = new VNCMain(this); // Additional connection tabs additionalTabs = new SshToolsConnectionTab[] { new VNCTab( /*vnc*/), new VNCAdvancedTab( /*vnc*/) }; add(vnc, BorderLayout.CENTER); initActions(); } catch (Throwable t) { StringWriter sw = new StringWriter(); t.printStackTrace(new PrintWriter(sw)); IconWrapperPanel p = new IconWrapperPanel( UIManager.getIcon("OptionPane.errorIcon"), new ErrorTextBox( ((t.getMessage() == null) ? "<no message supplied>" : t.getMessage()) + (debug ? ("\n\n" + sw.getBuffer().toString()) : ""))); p.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8)); add(p, BorderLayout.CENTER); throw new SshToolsApplicationException( "Failed to start SshVNC. ", t); } }
From source file:base.BasePlayer.AddGenome.java
public AddGenome() { super(new BorderLayout()); makeGenomes();/*from www. j av a2 s . com*/ tree = new JTree(root); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); sizeError.setForeground(Draw.redColor); sizeError.setVisible(true); treemodel = (DefaultTreeModel) tree.getModel(); remscroll = new JScrollPane(remtable); tree.setCellRenderer(new DefaultTreeCellRenderer() { private static final long serialVersionUID = 1L; private Icon collapsedIcon = UIManager.getIcon("Tree.collapsedIcon"); private Icon expandedIcon = UIManager.getIcon("Tree.expandedIcon"); // private Icon leafIcon = UIManager.getIcon("Tree.leafIcon"); private Icon addIcon = UIManager.getIcon("Tree.closedIcon"); // private Icon saveIcon = UIManager.getIcon("OptionPane.informationIcon"); @Override public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean isLeaf, int row, boolean focused) { Component c = super.getTreeCellRendererComponent(tree, value, selected, expanded, isLeaf, row, focused); if (!isLeaf) { //setFont(getFont().deriveFont(Font.PLAIN)); if (expanded) { setIcon(expandedIcon); } else { setIcon(collapsedIcon); } /* if(((DefaultMutableTreeNode) value).getUserObject().toString().equals("Annotations")) { this.setFocusable(false); setFont(getFont().deriveFont(Font.BOLD)); setIcon(null); } */ } else { if (((DefaultMutableTreeNode) value).getUserObject().toString().equals("Annotations")) { // setFont(getFont().deriveFont(Font.PLAIN)); setIcon(null); } else if (((DefaultMutableTreeNode) value).getUserObject().toString().startsWith("Add new")) { // setFont(getFont().deriveFont(Font.PLAIN)); setIcon(addIcon); } else { // setFont(getFont().deriveFont(Font.ITALIC)); setIcon(null); // setIcon(leafIcon); } } return c; } }); tree.addMouseListener(this); tree.addTreeSelectionListener(new TreeSelectionListener() { public void valueChanged(TreeSelectionEvent e) { try { DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent(); if (node == null) return; selectedNode = node; if (node.isLeaf()) { checkUpdates.setEnabled(false); } else { checkUpdates.setEnabled(true); } if (node.toString().startsWith("Add new") || node.toString().equals("Annotations")) { remove.setEnabled(false); } else { remove.setEnabled(true); } genometable.clearSelection(); download.setEnabled(false); } catch (Exception ex) { ex.printStackTrace(); } } }); tree.setToggleClickCount(1); tree.setRootVisible(false); treescroll = new JScrollPane(tree); checkGenomes(); genomeFileText = new JLabel("Select reference fasta-file"); annotationFileText = new JLabel("Select annotation gff3-file"); genomeName = new JTextField("Give name of the genome"); openRef = new JButton("Browse"); openAnno = new JButton("Browse"); add = new JButton("Add"); download = new JButton("Download"); checkEnsembl = new JButton("Ensembl fetch"); checkEnsembl.setMinimumSize(Main.buttonDimension); checkEnsembl.addActionListener(this); getLinks = new JButton("Get file links."); remove = new JButton("Remove"); checkUpdates = new JButton("Check updates"); download.setEnabled(false); getLinks.setEnabled(false); getLinks.addActionListener(this); remove.setEnabled(false); download.addActionListener(this); remove.addActionListener(this); panel.setBackground(Draw.sidecolor); checkUpdates.addActionListener(this); this.setBackground(Draw.sidecolor); frame.getContentPane().setBackground(Draw.sidecolor); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.insets = new Insets(2, 4, 2, 4); c.gridwidth = 2; genometable.setSelectionMode(0); genometable.setShowGrid(false); remtable.setSelectionMode(0); remtable.setShowGrid(false); JScrollPane scroll = new JScrollPane(); scroll.getViewport().setBackground(Color.white); scroll.getViewport().add(genometable); remscroll.getViewport().setBackground(Color.white); genometable.addMouseListener(this); remtable.addMouseListener(this); // panel.add(welcomeLabel,c); // c.gridy++; c.anchor = GridBagConstraints.NORTHWEST; panel.add(new JLabel("Download genome reference and annotation"), c); c.gridx++; c.anchor = GridBagConstraints.NORTHEAST; panel.add(checkEnsembl, c); c.anchor = GridBagConstraints.NORTHWEST; c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy++; //c.fill = GridBagConstraints.NONE; panel.add(scroll, c); c.gridy++; c.fill = GridBagConstraints.NONE; panel.add(download, c); c.gridx = 1; panel.add(sizeError, c); c.gridx = 1; panel.add(getLinks, c); c.gridy++; c.gridx = 0; c.fill = GridBagConstraints.BOTH; panel.add(new JLabel("Add/Remove installed genomes manually"), c); c.gridy++; panel.add(treescroll, c); c.gridy++; c.fill = GridBagConstraints.NONE; c.gridwidth = 1; remove.setMinimumSize(Main.buttonDimension); panel.add(remove, c); c.gridx = 1; panel.add(checkUpdates, c); checkUpdates.setMinimumSize(Main.buttonDimension); checkUpdates.setEnabled(false); c.gridwidth = 2; c.gridx = 0; c.gridy++; try { if (Main.genomeDir != null) { genomedirectory.setText(Main.genomeDir.getCanonicalPath()); } genomedirectory.setEditable(false); genomedirectory.setBackground(Color.white); genomedirectory.setForeground(Color.black); } catch (IOException e1) { e1.printStackTrace(); } panel.add(new JLabel("Genome directory:"), c); c.gridy++; panel.add(genomedirectory, c); /* c.fill = GridBagConstraints.BOTH; c.gridy++; panel.add(new JLabel("Add genome manually"),c); c.gridy++; c.gridwidth = 2; panel.add(new JSeparator(),c); c.gridwidth = 1; c.gridy++; panel.add(genomeFileText, c); c.fill = GridBagConstraints.NONE; c.gridx = 1; panel.add(openRef, c); c.gridx = 0; openRef.addActionListener(this); c.gridy++; panel.add(annotationFileText,c); c.gridx=1; panel.add(openAnno, c); c.gridy++; panel.add(add,c); openAnno.addActionListener(this); add.addActionListener(this); add.setEnabled(false); */ add(panel, BorderLayout.NORTH); if (Main.drawCanvas != null) { setFonts(Main.menuFont); } /* html.append("<a href=http:Homo_sapiens_GRCh37:Ensembl_genes> Homo sapiens GRCh37 with Ensembl</a> or <a href=http:Homo_sapiens_GRCh37:RefSeq_genes>RefSeq</a> gene annotations<br>"); html.append("<a href=http:Homo_sapiens_GRCh38:Ensembl_genes> Homo sapiens GRCh38 with Ensembl</a> or <a href=http:Homo_sapiens_GRCh38:RefSeq_genes>RefSeq</a> gene annotations<br><br>"); html.append("<a href=http:Mus_musculus_GRCm38:Ensembl_genes> Mus musculus GRCm38 with Ensembl</a> or <a href=http:Mus_musculus_GRCm38:RefSeq_genes>RefSeq</a> gene annotations<br>"); html.append("<a href=http:Rattus_norvegicus:Ensembl_genes> Rattus norvegicus with Ensembl gene annotations</a><br>"); html.append("<a href=http:Saccharomyces_cerevisiae:Ensembl_genes> Saccharomyces cerevisiae with Ensembl gene annotation</a><br>"); html.append("<a href=http:Ciona_intestinalis:Ensembl_genes> Ciona intestinalis with Ensembl gene annotation</a><br>"); Object[] row = {"Homo_sapiens_GRCh37"}; Object[] row = {"Homo_sapiens_GRCh38"}; model.addRow(row); /* genomeName.setPreferredSize(new Dimension(300,20)); this.add(genomeName); this.add(new JSeparator()); this.add(openRef); openRef.addActionListener(this); this.add(genomeFileText); this.add(openAnno); openAnno.addActionListener(this); this.add(annotationFileText); this.add(add); add.addActionListener(this); if(annotation) { openRef.setVisible(false); genomeFileText.setVisible(false); genomeName.setEditable(false); } genomeFileText.setEditable(false); annotationFileText.setEditable(false);*/ }
From source file:be.ugent.maf.cellmissy.gui.controller.analysis.singlecell.filtering.FilteringController.java
/** * Initialize the main view: the filtering panel (the two sub-views are kept * in two separate controllers)./*from w ww . j a v a 2s. co m*/ */ private void initFilteringPanel() { // make a new view filteringPanel = new FilteringPanel(); // make a new radio button group for the radio buttons ButtonGroup radioButtonGroup = new ButtonGroup(); radioButtonGroup.add(filteringPanel.getSingleCutOffRadioButton()); radioButtonGroup.add(filteringPanel.getMultipleCutOffRadioButton()); // select the first one as default filteringPanel.getMultipleCutOffRadioButton().setSelected(true); // set icon for question button Icon questionIcon = UIManager.getIcon("OptionPane.questionIcon"); ImageIcon scaledQuestionIcon = GuiUtils.getScaledIcon(questionIcon); filteringPanel.getQuestionButton().setIcon(scaledQuestionIcon); // action listeners // info button filteringPanel.getQuestionButton().addActionListener((ActionEvent e) -> { // pack and show info dialog GuiUtils.centerDialogOnFrame(singleCellPreProcessingController.getMainFrame(), filteringInfoDialog); filteringInfoDialog.setVisible(true); }); // which criterium for the filtering? filteringPanel.getMultipleCutOffRadioButton().addActionListener((ActionEvent e) -> { // need to reset the conditions list back to active singleCellPreProcessingController.getConditionsList().setEnabled(true); // set as the current condition the first one in the list singleCellPreProcessingController .setCurrentCondition(singleCellPreProcessingController.getPlateConditionList().get(0)); singleCellPreProcessingController.getAnalysisPlatePanel() .setCurrentCondition(singleCellPreProcessingController.getPlateConditionList().get(0)); singleCellPreProcessingController.getAnalysisPlatePanel().repaint(); // get the layout from the bottom panel and show the appropriate one CardLayout layout = (CardLayout) filteringPanel.getBottomPanel().getLayout(); layout.show(filteringPanel.getBottomPanel(), filteringPanel.getMultipleCutOffParentPanel().getName()); multipleCutOffFilteringController.plotRawKdeMultipleCutOff(getCurrentCondition()); setMedianDisplForCondition(getCurrentCondition()); setMedianDisplForExperiment(); }); filteringPanel.getSingleCutOffRadioButton().addActionListener((ActionEvent e) -> { // need to disable the conditions list singleCellPreProcessingController.getConditionsList().clearSelection(); singleCellPreProcessingController.getConditionsList().setEnabled(false); singleCellPreProcessingController.setCurrentCondition(null); singleCellPreProcessingController.getAnalysisPlatePanel().setCurrentCondition(null); singleCellPreProcessingController.getAnalysisPlatePanel().repaint(); // get the layout from the bottom panel and show the appropriate one CardLayout layout = (CardLayout) filteringPanel.getBottomPanel().getLayout(); layout.show(filteringPanel.getBottomPanel(), filteringPanel.getSingleCutOffParentPanel().getName()); singleCutOffFilteringController.plotRawKdeSingleCutOff(); setMedianDisplForExperiment(); singleCutOffFilteringController.showMedianDisplInList(); }); // add view to parent container singleCellPreProcessingController.getSingleCellAnalysisPanel().getFilteringParentPanel().add(filteringPanel, gridBagConstraints); }
From source file:AST.DesignPatternDetection.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Murat Oruc btPathFinder = new JButton(); label1 = new JLabel(); tfPath = new JTextField(); label2 = new JLabel(); cbSelectionDP = new JComboBox<>(); btRun = new JButton(); label3 = new JLabel(); tfProjectName = new JTextField(); label4 = new JLabel(); tfThreshold = new JTextField(); chbOverlap = new JCheckBox(); btRunSgiso = new JButton(); scrollPane1 = new JScrollPane(); taInfo = new JTextArea(); label5 = new JLabel(); tfProgramPath = new JTextField(); btProgramPath = new JButton(); button1 = new JButton(); button2 = new JButton(); chbInnerClass = new JCheckBox(); //======== this ======== setTitle("DesPaD (Design Pattern Detector)"); setIconImage(((ImageIcon) UIManager.getIcon("FileView.computerIcon")).getImage()); addWindowListener(new WindowAdapter() { @Override//from ww w.j ava 2s. com public void windowClosing(WindowEvent e) { thisWindowClosing(e); } }); Container contentPane = getContentPane(); //---- btPathFinder ---- btPathFinder.setText("..."); btPathFinder.setFont(btPathFinder.getFont().deriveFont(btPathFinder.getFont().getSize() + 1f)); btPathFinder.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btPathFinderActionPerformed(e); } }); //---- label1 ---- label1.setText("Source Code Directory Path"); //---- tfPath ---- tfPath.setText("..."); tfPath.setEditable(false); tfPath.setForeground(Color.blue); tfPath.setFont(tfPath.getFont().deriveFont(tfPath.getFont().getStyle() | Font.BOLD)); //---- label2 ---- label2.setText("Select Design Pattern"); //---- cbSelectionDP ---- cbSelectionDP.setModel(new DefaultComboBoxModel<>( new String[] { "FACTORY_METHOD", "PROTOTYPE", "ABSTRACT_FACTORY", "BUILDER", "SINGLETON", "COMPOSITE", "FACADE", "DECORATOR", "DECORATOR2", "BRIDGE", "FLYWEIGHT", "ADAPTER", "PROXY", "MEDIATOR", "STATE", "OBSERVER", "TEMPLATE_METHOD", "TEMPLATE_METHOD2", "COMMAND", "CHAIN_OF_RESPONSIBILITY", "INTERPRETER", "MEMENTO", "ITERATOR", "STRATEGY", "VISITOR" })); //---- btRun ---- btRun.setText("1. Build Model Graph"); btRun.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { btRunActionPerformed(e); } catch (IOException | InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); //---- label3 ---- label3.setText("Project Name"); //---- label4 ---- label4.setText("Threshold"); //---- tfThreshold ---- tfThreshold.setText("0.0"); //---- chbOverlap ---- chbOverlap.setText("Overlap"); //---- btRunSgiso ---- btRunSgiso.setText("2. Run Subdue-Sgiso Algorithm"); btRunSgiso.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { btRunSgisoActionPerformed(e); } catch (IOException | InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); //======== scrollPane1 ======== { scrollPane1.setViewportView(taInfo); } //---- label5 ---- label5.setText("Program Directory Path"); //---- tfProgramPath ---- tfProgramPath.setEditable(false); tfProgramPath.setForeground(Color.blue); tfProgramPath.setFont(tfProgramPath.getFont().deriveFont(tfProgramPath.getFont().getStyle() | Font.BOLD)); //---- btProgramPath ---- btProgramPath.setText("..."); btProgramPath.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btProgramPathActionPerformed(e); } }); //---- button1 ---- button1.setText("3. Exclude overlap outputs"); button1.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { button1ActionPerformed(e); } catch (FileNotFoundException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); //---- button2 ---- button2.setText("4. Graph Representations"); button2.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { try { button2ActionPerformed(e); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } }); //---- chbInnerClass ---- chbInnerClass.setText("Include Inner Classes"); chbInnerClass.setSelected(true); GroupLayout contentPaneLayout = new GroupLayout(contentPane); contentPane.setLayout(contentPaneLayout); contentPaneLayout.setHorizontalGroup( contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout.createSequentialGroup() .addContainerGap().addGroup(contentPaneLayout .createParallelGroup().addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup().addComponent(label1).addGap(21, 433, Short.MAX_VALUE)) .addGroup(contentPaneLayout .createSequentialGroup().addGroup(contentPaneLayout.createParallelGroup() .addComponent(label4).addGroup(contentPaneLayout .createSequentialGroup().addGroup(contentPaneLayout .createParallelGroup(GroupLayout.Alignment.TRAILING, false) .addComponent( button1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE) .addComponent(tfThreshold, GroupLayout.Alignment.LEADING) .addComponent(cbSelectionDP, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE) .addComponent(label2, GroupLayout.Alignment.LEADING) .addComponent( btRun, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)) .addGap(30, 30, 30) .addGroup(contentPaneLayout .createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(label3) .addComponent(tfProjectName, GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE) .addGroup(contentPaneLayout.createSequentialGroup() .addComponent(chbOverlap) .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(chbInnerClass)) .addComponent(btRunSgiso, GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE) .addComponent( button2, GroupLayout.DEFAULT_SIZE, 260, Short.MAX_VALUE)))) .addGap(0, 56, Short.MAX_VALUE)) .addGroup(GroupLayout.Alignment.TRAILING, contentPaneLayout.createSequentialGroup().addGroup(contentPaneLayout .createParallelGroup(GroupLayout.Alignment.TRAILING) .addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 594, Short.MAX_VALUE) .addGroup(contentPaneLayout.createSequentialGroup() .addGroup(contentPaneLayout.createParallelGroup() .addGroup(contentPaneLayout.createSequentialGroup() .addComponent(label5) .addGap(0, 418, Short.MAX_VALUE)) .addComponent(tfProgramPath, GroupLayout.DEFAULT_SIZE, 564, Short.MAX_VALUE) .addComponent( tfPath, GroupLayout.Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 564, Short.MAX_VALUE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(contentPaneLayout .createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(btPathFinder, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(btProgramPath, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) .addContainerGap())))); contentPaneLayout.setVerticalGroup(contentPaneLayout.createParallelGroup().addGroup(contentPaneLayout .createSequentialGroup().addGap(29, 29, 29).addComponent(label1).addGap(5, 5, 5) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(tfPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(btPathFinder, GroupLayout.DEFAULT_SIZE, 31, Short.MAX_VALUE)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(label5) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(tfProgramPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(btProgramPath)) .addGap(18, 18, 18) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(label2) .addComponent(label3)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(cbSelectionDP, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(tfProjectName, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18).addComponent(label4).addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(tfThreshold, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent(chbOverlap).addComponent(chbInnerClass)) .addGap(18, 18, 18) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(btRun, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE) .addComponent(btRunSgiso, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE)) .addGap(18, 18, 18) .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(button2, GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE) .addComponent(button1, GroupLayout.DEFAULT_SIZE, 45, Short.MAX_VALUE)) .addGap(18, 18, 18).addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE) .addContainerGap())); setSize(630, 625); setLocationRelativeTo(null); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:io.github.jeddict.reveng.klass.RevEngWizardDescriptor.java
private EntityMappings generateJPAModel(final ProgressReporter reporter, EntityMappings entityMappings, final FileObject sourcePackage, final Set<String> entities, final FileObject targetFilePath, final String targetFileName, final boolean includeReference, final boolean softWrite, final boolean autoOpen) throws IOException, ProcessInterruptedException { int progressIndex = 0; String progressMsg = getMessage(RevEngWizardDescriptor.class, "MSG_Progress_JPA_Model_Pre"); //NOI18N; reporter.progress(progressMsg, progressIndex++); List<String> missingEntities = new ArrayList<>(); SourceExplorer source = new SourceExplorer(sourcePackage, entityMappings, entities, includeReference); for (String entityClassFQN : entities) { try {/* w w w . j a v a 2 s. co m*/ source.createClass(entityClassFQN); } catch (FileNotFoundException ex) { ex.printStackTrace(); missingEntities.add(entityClassFQN); } } progressIndex = loadJavaClasses(reporter, progressIndex, source.getClasses(), entityMappings); List<ClassExplorer> classes = checkReferencedClasses(source, missingEntities, includeReference); while (!classes.isEmpty()) { progressIndex = loadJavaClasses(reporter, progressIndex, classes, entityMappings); classes = checkReferencedClasses(source, missingEntities, includeReference); } if (!missingEntities.isEmpty()) { final String title, _package; StringBuilder message = new StringBuilder(); if (missingEntities.size() == 1) { title = "Conflict detected - Entity not found"; message.append(JavaSourceParserUtil.simpleClassName(missingEntities.get(0))).append(" Entity is "); } else { title = "Conflict detected - Entities not found"; message.append("Entities ").append(missingEntities.stream() .map(e -> JavaSourceParserUtil.simpleClassName(e)).collect(toList())).append(" are "); } if (isEmpty(entityMappings.getPackage())) { _package = "<default_root_package>"; } else { _package = entityMappings.getPackage(); } message.append("missing in Project classpath[").append(_package) .append("]. \n Would like to cancel the process ?"); SwingUtilities.invokeLater(() -> { JButton cancel = new JButton("Cancel import process (Recommended)"); JButton procced = new JButton("Procced"); cancel.addActionListener((ActionEvent e) -> { Window w = SwingUtilities.getWindowAncestor(cancel); if (w != null) { w.setVisible(false); } StringBuilder sb = new StringBuilder(); sb.append('\n').append("You have following option to resolve conflict :").append('\n') .append('\n'); sb.append( "1- New File > Persistence > JPA Diagram from Reverse Engineering (Manually select entities)") .append('\n'); sb.append( "2- Recover missing entities manually > Reopen diagram file > Import entities again"); NotifyDescriptor nd = new NotifyDescriptor.Message(sb.toString(), NotifyDescriptor.INFORMATION_MESSAGE); DialogDisplayer.getDefault().notify(nd); }); procced.addActionListener(e -> { Window window = SwingUtilities.getWindowAncestor(cancel); if (nonNull(window)) { window.setVisible(false); } manageEntityMapping(entityMappings); if (nonNull(targetFilePath) && nonNull(targetFileName)) { JPAModelerUtil.createNewModelerFile(entityMappings, targetFilePath, targetFileName, softWrite, autoOpen); } }); JOptionPane.showOptionDialog(WindowManager.getDefault().getMainWindow(), message.toString(), title, OK_CANCEL_OPTION, ERROR_MESSAGE, UIManager.getIcon("OptionPane.errorIcon"), new Object[] { cancel, procced }, cancel); }); } else { manageEntityMapping(entityMappings); if (nonNull(targetFilePath) && nonNull(targetFileName)) { JPAModelerUtil.createNewModelerFile(entityMappings, targetFilePath, targetFileName, softWrite, autoOpen); } return entityMappings; } throw new ProcessInterruptedException(); }