List of usage examples for javax.swing JTextArea setFont
public void setFont(Font f)
From source file:org.opencms.applet.upload.FileUploadApplet.java
/** * Displays the dialog that shows the list of files that will be overwritten on the server. * <p>//from w ww .ja v a2 s. com * The user may uncheck the checkboxes in front of the relative paths to avoid overwriting. * <p> * * @param duplications * a list of Strings that are relative paths to the files that will be overwritten on the server * * @return one of */ private int showDuplicationsDialog(List duplications) { int rtv = ModalDialog.ERROR_OPTION; try { JTextArea dialogIntroPanel = new JTextArea(); dialogIntroPanel.setLineWrap(true); dialogIntroPanel.setWrapStyleWord(true); dialogIntroPanel.setText(m_overwriteDialogIntro); dialogIntroPanel.setEditable(false); dialogIntroPanel.setBackground(m_fileSelector.getBackground()); dialogIntroPanel.setFont(m_font); FileSelectionPanel selectionPanel = new FileSelectionPanel(duplications, m_fileSelector.getCurrentDirectory().getAbsolutePath()); JPanel stacker = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); gbc.anchor = GridBagConstraints.NORTHWEST; gbc.gridheight = 1; gbc.gridwidth = 1; gbc.weightx = 1f; gbc.weighty = 0f; gbc.gridx = 0; gbc.gridy = 0; gbc.fill = GridBagConstraints.BOTH; gbc.insets = new Insets(2, 2, 2, 2); stacker.add(dialogIntroPanel, gbc); gbc.weighty = 1f; gbc.gridy = 1; gbc.insets = new Insets(0, 2, 0, 2); stacker.add(selectionPanel, gbc); m_overwriteDialog = new ModalDialog(m_fileSelector, m_overwriteDialogTitle, m_overwriteDialogOk, m_overwriteDialogCancel, stacker); m_overwriteDialog.setSize(new Dimension(560, 280)); //dialog.setResizable(false); m_overwriteDialog.showDialog(); rtv = m_overwriteDialog.getReturnValue(); } catch (Throwable f) { f.printStackTrace(System.err); } return rtv; }
From source file:org.openscience.jmol.app.Jmol.java
public static void main(String[] args) { Dialog.setupUIManager();//from w w w . j av a2s . com Jmol jmol = null; String modelFilename = null; String scriptFilename = null; Options options = new Options(); options.addOption("b", "backgroundtransparent", false, GT._("transparent background")); options.addOption("h", "help", false, GT._("give this help page")); options.addOption("n", "nodisplay", false, GT._("no display (and also exit when done)")); options.addOption("c", "check", false, GT._("check script syntax only")); options.addOption("i", "silent", false, GT._("silent startup operation")); options.addOption("l", "list", false, GT._("list commands during script execution")); options.addOption("o", "noconsole", false, GT._("no console -- all output to sysout")); options.addOption("t", "threaded", false, GT._("independent commmand thread")); options.addOption("x", "exit", false, GT._("exit after script (implicit with -n)")); OptionBuilder.withLongOpt("script"); OptionBuilder.withDescription("script file to execute"); OptionBuilder.withValueSeparator('='); OptionBuilder.hasArg(); options.addOption(OptionBuilder.create("s")); OptionBuilder.withLongOpt("menu"); OptionBuilder.withDescription("menu file to use"); OptionBuilder.withValueSeparator('='); OptionBuilder.hasArg(); options.addOption(OptionBuilder.create("m")); OptionBuilder.withArgName(GT._("property=value")); OptionBuilder.hasArg(); OptionBuilder.withValueSeparator(); OptionBuilder.withDescription(GT._("supported options are given below")); options.addOption(OptionBuilder.create("D")); OptionBuilder.withLongOpt("geometry"); // OptionBuilder.withDescription(GT._("overall window width x height, e.g. {0}", "-g512x616")); OptionBuilder.withDescription(GT._("window width x height, e.g. {0}", "-g500x500")); OptionBuilder.withValueSeparator(); OptionBuilder.hasArg(); options.addOption(OptionBuilder.create("g")); OptionBuilder.withLongOpt("quality"); // OptionBuilder.withDescription(GT._("overall window width x height, e.g. {0}", "-g512x616")); OptionBuilder.withDescription(GT._( "JPG image quality (1-100; default 75) or PNG image compression (0-9; default 2, maximum compression 9)")); OptionBuilder.withValueSeparator(); OptionBuilder.hasArg(); options.addOption(OptionBuilder.create("q")); OptionBuilder.withLongOpt("write"); OptionBuilder .withDescription(GT._("{0} or {1}:filename", new Object[] { "CLIP", "GIF|JPG|JPG64|PNG|PPM" })); OptionBuilder.withValueSeparator(); OptionBuilder.hasArg(); options.addOption(OptionBuilder.create("w")); int startupWidth = 0, startupHeight = 0; CommandLine line = null; try { CommandLineParser parser = new PosixParser(); line = parser.parse(options, args); } catch (ParseException exception) { System.err.println("Unexpected exception: " + exception.toString()); } if (line.hasOption("h")) { HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("Jmol", options); // now report on the -D options System.out.println(); System.out.println(GT._("For example:")); System.out.println(); System.out.println("Jmol -ions myscript.spt -w JPEG:myfile.jpg > output.txt"); System.out.println(); System.out.println(GT._("The -D options are as follows (defaults in parenthesis):")); System.out.println(); System.out.println(" cdk.debugging=[true|false] (false)"); System.out.println(" cdk.debug.stdout=[true|false] (false)"); System.out.println(" display.speed=[fps|ms] (ms)"); System.out.println(" JmolConsole=[true|false] (true)"); System.out.println(" jmol.logger.debug=[true|false] (false)"); System.out.println(" jmol.logger.error=[true|false] (true)"); System.out.println(" jmol.logger.fatal=[true|false] (true)"); System.out.println(" jmol.logger.info=[true|false] (true)"); System.out.println(" jmol.logger.logLevel=[true|false] (false)"); System.out.println(" jmol.logger.warn=[true|false] (true)"); System.out.println(" plugin.dir (unset)"); System.out.println(" user.language=[CA|CS|DE|EN|ES|FR|NL|PT|TR] (EN)"); System.exit(0); } args = line.getArgs(); if (args.length > 0) { modelFilename = args[0]; } // Process more command line arguments // these are also passed to viewer String commandOptions = ""; //silent startup if (line.hasOption("i")) { commandOptions += "-i"; isSilent = Boolean.TRUE; } // transparent background if (line.hasOption("b")) { commandOptions += "-b"; } // independent command thread if (line.hasOption("t")) { commandOptions += "-t"; } //list commands during script operation if (line.hasOption("l")) { commandOptions += "-l"; } //output to sysout if (line.hasOption("o")) { commandOptions += "-o"; haveConsole = Boolean.FALSE; } //no display (and exit) if (line.hasOption("n")) { // this ensures that noDisplay also exits commandOptions += "-n-x"; haveDisplay = Boolean.FALSE; } //check script only if (line.hasOption("c")) { commandOptions += "-c"; } //run script if (line.hasOption("s")) { commandOptions += "-s"; scriptFilename = line.getOptionValue("s"); } //menu file if (line.hasOption("m")) { menuFile = line.getOptionValue("m"); } //exit when script completes (or file is read) if (line.hasOption("x")) { commandOptions += "-x"; } String imageType_name = null; //write image to clipboard or image file if (line.hasOption("w")) { imageType_name = line.getOptionValue("w"); } Dimension size; try { String vers = System.getProperty("java.version"); if (vers.compareTo("1.1.2") < 0) { System.out.println("!!!WARNING: Swing components require a " + "1.1.2 or higher version VM!!!"); } size = historyFile.getWindowSize(JMOL_WINDOW_NAME); if (size != null && haveDisplay.booleanValue()) { startupWidth = size.width; startupHeight = size.height; } //OUTER window dimensions /* if (line.hasOption("g") && haveDisplay.booleanValue()) { String geometry = line.getOptionValue("g"); int indexX = geometry.indexOf('x'); if (indexX > 0) { startupWidth = parseInt(geometry.substring(0, indexX)); startupHeight = parseInt(geometry.substring(indexX + 1)); } } */ Point b = historyFile.getWindowBorder(JMOL_WINDOW_NAME); //first one is just approximate, but this is set in doClose() //so it will reset properly -- still, not perfect //since it is always one step behind. if (b == null) border = new Point(12, 116); else border = new Point(b.x, b.y); //note -- the first time this is run after changes it will not work //because there is a bootstrap problem. int width = -1; int height = -1; int quality = 75; //INNER frame dimensions if (line.hasOption("g")) { String geometry = line.getOptionValue("g"); int indexX = geometry.indexOf('x'); if (indexX > 0) { width = Parser.parseInt(geometry.substring(0, indexX)); height = Parser.parseInt(geometry.substring(indexX + 1)); //System.out.println("setting geometry to " + geometry + " " + border + " " + startupWidth + startupHeight); } if (haveDisplay.booleanValue()) { startupWidth = width + border.x; startupHeight = height + border.y; } } if (line.hasOption("q")) quality = Parser.parseInt(line.getOptionValue("q")); if (imageType_name != null) commandOptions += "-w\1" + imageType_name + "\t" + width + "\t" + height + "\t" + quality + "\1"; if (startupWidth <= 0 || startupHeight <= 0) { startupWidth = 500 + border.x; startupHeight = 500 + border.y; } JFrame jmolFrame = new JFrame(); Point jmolPosition = historyFile.getWindowPosition(JMOL_WINDOW_NAME); if (jmolPosition != null) { jmolFrame.setLocation(jmolPosition); } //now pass these to viewer jmol = getJmol(jmolFrame, startupWidth, startupHeight, commandOptions); // Open a file if one is given as an argument -- note, this CAN be a script file if (modelFilename != null) { jmol.viewer.openFile(modelFilename); jmol.viewer.getOpenFileError(); } // OK, by now it is time to execute the script if (scriptFilename != null) { report("Executing script: " + scriptFilename); if (haveDisplay.booleanValue()) jmol.splash.showStatus(GT._("Executing script...")); jmol.viewer.evalFile(scriptFilename); } } catch (Throwable t) { System.out.println("uncaught exception: " + t); t.printStackTrace(); } if (haveConsole.booleanValue()) { Point location = jmol.frame.getLocation(); size = jmol.frame.getSize(); // Adding console frame to grab System.out & System.err consoleframe = new JFrame(GT._("Jmol Java Console")); consoleframe.setIconImage(jmol.frame.getIconImage()); try { final ConsoleTextArea consoleTextArea = new ConsoleTextArea(); consoleTextArea.setFont(java.awt.Font.decode("monospaced")); consoleframe.getContentPane().add(new JScrollPane(consoleTextArea), java.awt.BorderLayout.CENTER); if (Boolean.getBoolean("clearConsoleButton")) { JButton buttonClear = new JButton(GT._("Clear")); buttonClear.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { consoleTextArea.setText(""); } }); consoleframe.getContentPane().add(buttonClear, java.awt.BorderLayout.SOUTH); } } catch (IOException e) { JTextArea errorTextArea = new JTextArea(); errorTextArea.setFont(java.awt.Font.decode("monospaced")); consoleframe.getContentPane().add(new JScrollPane(errorTextArea), java.awt.BorderLayout.CENTER); errorTextArea.append(GT._("Could not create ConsoleTextArea: ") + e); } Dimension consoleSize = historyFile.getWindowSize(CONSOLE_WINDOW_NAME); Point consolePosition = historyFile.getWindowPosition(CONSOLE_WINDOW_NAME); if ((consoleSize != null) && (consolePosition != null)) { consoleframe.setBounds(consolePosition.x, consolePosition.y, consoleSize.width, consoleSize.height); } else { consoleframe.setBounds(location.x, location.y + size.height, size.width, 200); } Boolean consoleVisible = historyFile.getWindowVisibility(CONSOLE_WINDOW_NAME); if ((consoleVisible != null) && (consoleVisible.equals(Boolean.TRUE))) { consoleframe.show(); } } }
From source file:org.pgptool.gui.ui.tools.UiUtils.java
private static JScrollPane getScrollableMessage(String msg) { JTextArea textArea = new JTextArea(msg); textArea.setLineWrap(true);/*from w w w . j av a2 s.c o m*/ textArea.setWrapStyleWord(true); textArea.setEditable(false); textArea.setMargin(new Insets(5, 5, 5, 5)); textArea.setFont(new JTextField().getFont()); // dirty fix to use better font JScrollPane scrollPane = new JScrollPane(); scrollPane.setPreferredSize(new Dimension(700, 150)); scrollPane.getViewport().setView(textArea); return scrollPane; }
From source file:org.p_vcd.ui.LicenseDialog.java
public LicenseDialog(String libName, String libHomepage, String licenseName, String licenseFilename) { setSize(680, 480);//w w w.j a v a2 s.c o m setTitle(libName); getContentPane().setLayout(new BorderLayout()); { JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.NORTH); panel.setLayout(new MigLayout("", "[grow,trailing][grow]", "[20px][][]")); { JLabel lblSoft = new JLabel(libName); lblSoft.setFont(new Font("Tahoma", Font.BOLD, 16)); panel.add(lblSoft, "center,cell 0 0 2 1"); } { JLabel lblHomePage = new JLabel("Home page:"); lblHomePage.setFont(new Font("Tahoma", Font.BOLD, 14)); panel.add(lblHomePage, "cell 0 1"); } { JLabel lblHome = SwingUtil.createLink(libHomepage, libHomepage); lblHome.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel.add(lblHome, "cell 1 1"); } { JLabel lblNewLabel = new JLabel("License:"); lblNewLabel.setFont(new Font("Tahoma", Font.BOLD, 14)); panel.add(lblNewLabel, "cell 0 2"); } { JLabel lblLicense = new JLabel(licenseName); lblLicense.setFont(new Font("Tahoma", Font.PLAIN, 14)); panel.add(lblLicense, "cell 1 2"); } } { JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.CENTER); panel.setLayout(new FlowLayout()); panel.setBorder(new EmptyBorder(5, 5, 5, 5)); JScrollPane scrollPane = new JScrollPane(); scrollPane.setPreferredSize(new Dimension(600, 300)); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); panel.add(scrollPane); { JTextArea txtLicense = new JTextArea(); txtLicense.setEditable(false); txtLicense.setFont(new Font("Monospaced", Font.PLAIN, 11)); txtLicense.setWrapStyleWord(true); txtLicense.setLineWrap(true); try { InputStream is = Thread.currentThread().getContextClassLoader() .getResourceAsStream("org/p_vcd/licenses/" + licenseFilename); String text = IOUtils.toString(is, "UTF-8"); IOUtils.closeQuietly(is); txtLicense.setText(text); txtLicense.setCaretPosition(0); } catch (Exception e) { e.printStackTrace(); } scrollPane.setViewportView(txtLicense); } } { JPanel panel = new JPanel(); getContentPane().add(panel, BorderLayout.SOUTH); panel.setLayout(new FlowLayout(FlowLayout.CENTER)); JButton okButton = new JButton("OK"); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { LicenseDialog.this.dispose(); } }); okButton.setActionCommand("OK"); panel.add(okButton); getRootPane().setDefaultButton(okButton); } }
From source file:org.revager.tools.GUITools.java
/** * Creates a new title text area for popup windows. * /* w ww . j a v a2s . c o m*/ * @param titleText * the title text * * @return the newly created text area */ public static JTextArea newPopupTitleArea(String titleText) { JTextArea textTitle = new JTextArea(); textTitle.setEditable(false); textTitle.setText(titleText); textTitle.setBackground(UI.POPUP_BACKGROUND); textTitle.setFont(UI.STANDARD_FONT.deriveFont(Font.BOLD)); textTitle.setLineWrap(true); textTitle.setWrapStyleWord(true); textTitle.setFocusable(false); textTitle.setBorder(new EmptyBorder(5, 5, 5, 5)); return textTitle; }
From source file:org.simmi.GeneSetHead.java
License:asdf
public void doBlastn(final String fasta, final String evaluestr, final boolean ids, final RunnableResult rr, boolean show) { /*File blastn;/*from ww w . ja va 2 s.c o m*/ File blastp; File makeblastdb; File blastx = new File( "c:\\\\Program files\\NCBI\\blast-2.2.29+\\bin\\blastx.exe" ); if( !blastx.exists() ) { blastx = new File( "/opt/ncbi-blast-2.2.29+/bin/blastx" ); if( !blastx.exists() ) { blastx = new File( "/usr/local/ncbi/blast/bin/blastx" ); blastn = new File( "/usr/local/ncbi/blast/bin/blastn" ); blastp = new File( "/usr/local/ncbi/blast/bin/blastp" ); makeblastdb = new File( "/usr/local/ncbi/blast/bin/makeblastdb" ); } else { blastn = new File( "/opt/ncbi-blast-2.2.29+/bin/blastn" ); blastp = new File( "/opt/ncbi-blast-2.2.29+/bin/blastp" ); makeblastdb = new File( "/opt/ncbi-blast-2.2.29+/bin/makeblastdb" ); } } else { blastn = new File( "c:\\\\Program files\\NCBI\\blast-2.2.29+\\bin\\blastn.exe" ); blastp = new File( "c:\\\\Program files\\NCBI\\blast-2.2.29+\\bin\\blastp.exe" ); makeblastdb = new File( "c:\\\\Program files\\NCBI\\blast-2.2.29+\\bin\\makeblastdb.exe" ); }*/ int procs = Runtime.getRuntime().availableProcessors(); String[] mcmds = { "makeblastdb", "-dbtype", "nucl", "-title", "tmp", "-out", "tmp" }; List<String> lcmd = new ArrayList<String>(Arrays.asList(mcmds)); final ProcessBuilder mpb = new ProcessBuilder(lcmd); mpb.redirectErrorStream(true); try { final Process mp = mpb.start(); new Thread() { public void run() { try { OutputStream pos = mp.getOutputStream(); for (String cname : geneset.contigmap.keySet()) { Sequence c = geneset.contigmap.get(cname); if (ids) pos.write((">" + c.id + "\n").getBytes()); else { pos.write((">" + c.getName() + "\n").getBytes()); } StringBuilder sb = c.getStringBuilder(); for (int i = 0; i < sb.length(); i += 70) { pos.write(sb.substring(i, Math.min(sb.length(), i + 70)).getBytes()); } pos.write('\n'); } pos.close(); } catch (IOException e) { e.printStackTrace(); } } }.start(); new Thread() { public void run() { try { InputStream pin = mp.getInputStream(); InputStreamReader rdr = new InputStreamReader(pin); //FileReader fr = new FileReader( new File("c:/dot.blastout") ); BufferedReader br = new BufferedReader(rdr); String line = br.readLine(); while (line != null) { System.out.println(line); line = br.readLine(); } pin.close(); } catch (IOException e) { e.printStackTrace(); } } }.run(); //File blastFile = blastn; //dbType.equals("prot") ? type.equals("prot") ? blastp : blastx : blastn; String[] cmds1 = { "blastn", "-dust", "no", "-perc_identity", "99", "-word_size", "21", "-query", "-", "-db", "tmp", "-evalue", evaluestr, "-num_threads", Integer.toString(procs) }; String[] cmds2 = { "blastn", "-query", "-", "-db", "tmp", "-evalue", evaluestr, "-num_threads", Integer.toString(procs) }; String[] cmds = show ? cmds2 : cmds1; lcmd = new ArrayList<String>(Arrays.asList(cmds)); //String[] exts = extrapar.trim().split("[\t ]+"); ProcessBuilder pb = new ProcessBuilder(lcmd); pb.redirectErrorStream(true); final Process p = pb.start(); final Thread t = new Thread() { public void run() { try { OutputStream pos = p.getOutputStream(); pos.write(fasta.getBytes()); pos.close(); } catch (IOException e) { e.printStackTrace(); } } }; t.start(); Map<String, Set<String>> tph = new HashMap<String, Set<String>>(); Map<String, Map<String, String>> tvp = new HashMap<String, Map<String, String>>(); Map<String, Map<String, String>> tmr = new HashMap<String, Map<String, String>>(); Map<String, Integer> specindex = new LinkedHashMap<String, Integer>(); Map<String, Integer> phindex = new LinkedHashMap<String, Integer>(); /*final Thread t2 = new Thread() { public void run() {*/ try { System.err.println("WHY NOT"); InputStreamReader rdr = new InputStreamReader(p.getInputStream()); //FileReader fr = new FileReader( new File("c:/dot.blastout") ); String qspec = null; String query = null; String ctype = null; Annotation at = new Annotation(); int o = 0; StringBuilder res = new StringBuilder(); BufferedReader br = new BufferedReader(rdr); String line = br.readLine(); res.append(line + "\n"); while (line != null) { if (line.startsWith("Query= ")) { query = line.substring(7, line.length()); int e = query.indexOf("CRISPR") - 1; if (e > 0) { qspec = query.substring(0, e); qspec = Sequence.getSpec(qspec); String rest = query.substring(e + 8); int ri = rest.lastIndexOf('-'); if (ri != -1) ctype = rest.substring(ri + 1); } else { System.err.println(); } line = br.readLine(); res.append(line + "\n"); while (!line.startsWith("Length")) { line = br.readLine(); res.append(line + "\n"); } o = Integer.parseInt(line.substring(7)); } else if (line.startsWith("> ")) { String contname = line.substring(1).trim(); //line = br.readLine(); //res.append( line+"\n" ); //int o = Integer.parseInt( line.substring(7) ); Sequence cont = geneset.contigmap.get(contname); if (cont != null) { int start = -1; int stop = 0; line = br.readLine(); res.append(line + "\n"); String lastmatch = null; while (line != null && !line.startsWith(">") && !line.startsWith("Query=") /*&& !line.contains("Expect =")*/ ) { if (line.startsWith("Sbjct")) { String[] split = line.split("[\t ]+"); int k = Integer.parseInt(split[1]); int m = Integer.parseInt(split[3]); lastmatch = split[2]; if (start == -1) start = k; stop = m; } line = br.readLine(); res.append(line + "\n"); } if (start > stop) { int tmp = start; start = stop; stop = tmp; } at.start = start; at.stop = stop; //if( stop - start < o*2 ) { List<Annotation> lann = cont.getAnnotations(); if (lann != null) { int k = Collections.binarySearch(lann, at); //System.err.println( "kkk " + k + " " + lann.size() ); if (k < 0) k = -(k + 1) - 1; Annotation ann = lann.get(Math.max(0, k)); boolean yes = true; if (ann.type != null && ann.type.contains("ummer")) { yes = false; } int u = k - 1; Annotation nann = null; if (u >= 0 && u < lann.size()) nann = lann.get(u); u = k + 1; Annotation rann = null; if (u >= 0 && u < lann.size()) rann = lann.get(u); if (nann != null && nann.type != null && nann.type.contains("ummer")) { yes = false; } if (rann != null && rann.type != null && rann.type.contains("ummer")) { yes = false; } if (!yes) { //System.err.println(); } Gene g = ann.getGene(); String desig = ann.designation; if (yes && g != null) { //ann.stop > at.start && ann.start < at.stop ) { GeneGroup gg = g.getGeneGroup(); if (desig != null && desig.contains("phage")) { if (!phindex.containsKey(desig)) phindex.put(desig, phindex.size()); Map<String, String> tvps; String specname = qspec;//Sequence.nameFix(qspec, true); if (!specindex.containsKey(specname)) specindex.put(specname, specindex.size()); if (tvp.containsKey(specname)) { tvps = tvp.get(specname); } else { tvps = new HashMap<String, String>(); tvp.put(specname, tvps); } tvps.put(desig, ctype); String contspec = cont.getSpec(); System.err.println(query + " asdf " + contspec + " " + lastmatch + " " + at.start + " " + at.stop + " " + ann.start + " " + ann.stop + " rann " + (rann != null ? rann.start + " " + rann.stop : "") + " nann " + (nann != null ? nann.start + " " + nann.stop : "")); if (qspec.equals(contspec)) { if (tmr.containsKey(specname)) { tvps = tmr.get(specname); } else { tvps = new HashMap<String, String>(); tmr.put(specname, tvps); } tvps.put(desig, ctype); } /*if( specname.contains("brockianus_MAT_338") ) { System.err.println(); }*/ } Platform.runLater(() -> { if (!isGeneview()) { /*int ggindex = geneset.allgenegroups.indexOf( gg ); int i = table.convertRowIndexToView( ggindex ); if( i != -1 ) table.addRowSelectionInterval(i, i);*/ table.getSelectionModel().select(gg); } else { /*int gindex = geneset.genelist.indexOf( g ); int i = table.convertRowIndexToView( gindex ); table.addRowSelectionInterval(i, i);*/ gtable.getSelectionModel().select(g); } }); } /*for( Annotation ann : lann ) { if( ann.stop > start && ann.start < stop ) { Gene g = ann.getGene(); if( g != null ) { if( table.getModel() == groupModel ) { GeneGroup gg = g.getGeneGroup(); int ggindex = allgenegroups.indexOf( gg ); int i = table.convertRowIndexToView( ggindex ); table.addRowSelectionInterval(i, i); } else if( table.getModel() == defaultModel ) { int gindex = geneset.genelist.indexOf( g ); int i = table.convertRowIndexToView( gindex ); table.addRowSelectionInterval(i, i); } } } }*/ } //} continue; } } /*int i = line.indexOf(' ', 2); if( i == -1 ) i = line.length(); String id = line.substring(2, i); Gene g = genemap.get( id ); if( g != null ) { if( table.getModel() == groupModel ) { i = allgenegroups.indexOf( g.getGeneGroup() ); if( i != -1 && i < table.getRowCount() ) { int r = table.convertRowIndexToView( i ); table.addRowSelectionInterval(r, r); } } else { i = geneset.genelist.indexOf( g ); if( i != -1 && i < table.getRowCount() ) { int r = table.convertRowIndexToView( i ); table.addRowSelectionInterval(r, r); } } } String stuff = line+"\n"; line = br.readLine(); while( line != null && !line.startsWith("Query=") && !line.startsWith("> ") ) { stuff += line+"\n"; line = br.readLine(); } if( rr != null ) { rr.run( stuff ); //res += line+"\n"; } } //else*/ line = br.readLine(); res.append(line + "\n"); } br.close(); p.destroy(); for (String specname : geneset.speccontigMap.keySet()) { List<Sequence> lseq = geneset.speccontigMap.get(specname); for (Sequence seq : lseq) { List<Annotation> lann = seq.getAnnotations(); if (lann != null) { for (Annotation a : lann) { String desig = a.designation; if (desig != null && desig.contains("phage") && phindex.containsKey(desig)) { if (!specindex.containsKey(specname)) specindex.put(specname, specindex.size()); Set<String> tvps; if (tph.containsKey(specname)) { tvps = tph.get(specname); } else { tvps = new HashSet<String>(); tph.put(specname, tvps); } tvps.add(desig); } } } } } int k = 0; int u = 0; Workbook wb = new XSSFWorkbook(); Sheet sh = wb.createSheet("Phage"); Row rw = sh.createRow(u++); //res = new StringBuilder(); for (String ph : phindex.keySet()) { res.append("\t" + ph); rw.createCell(++k).setCellValue(ph); } res.append("\n"); for (String rspec : specindex.keySet()) { String spec = Sequence.nameFix(rspec, true); rw = sh.createRow(u++); k = 0; rw.createCell(k++).setCellValue(spec); Map<String, String> set = tvp.get(rspec); res.append(spec); if (set != null) { for (String ph : phindex.keySet()) { if (set.containsKey(ph)) { String type = set.get(ph); if (type == null || type.length() == 0) type = "yes"; res.append("\t" + type); rw.createCell(k).setCellValue(type); } else { res.append("\t"); } k++; } } res.append("\n"); } for (String ph : phindex.keySet()) { res.append("\t" + ph); } res.append("\n"); u++; for (String rspec : specindex.keySet()) { String spec = Sequence.nameFix(rspec, true); rw = sh.createRow(u++); k = 0; rw.createCell(k++).setCellValue(spec); Map<String, String> set = tmr.get(rspec); res.append(spec); if (set != null) { for (String ph : phindex.keySet()) { if (set.containsKey(ph)) { String type = set.get(ph); if (type == null || type.length() == 0) type = "yes"; res.append("\t" + type); rw.createCell(k).setCellValue(type); } else res.append("\t"); k++; } } res.append("\n"); } u++; for (String rspec : specindex.keySet()) { String spec = Sequence.nameFix(rspec, true); rw = sh.createRow(u++); k = 0; rw.createCell(k++).setCellValue(spec); Set<String> set = tph.get(rspec); Map<String, String> setvp = tvp.get(rspec); res.append(spec); if (set != null) { for (String ph : phindex.keySet()) { if (set.contains(ph)) { if (setvp != null && setvp.containsKey(ph)) { res.append("\tyes wspacer"); rw.createCell(k).setCellValue("yes wspacer"); } else { res.append("\tyes"); rw.createCell(k).setCellValue("yes"); } } else res.append("\t"); k++; } } res.append("\n"); } File file = new File("/Users/sigmar/phage.xlsx"); FileOutputStream fos = new FileOutputStream(file); wb.write(fos); fos.close(); Desktop.getDesktop().open(file); //if( !show ) { JFrame frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.setSize(800, 600); JTextArea ta = new JTextArea(); ta.setFont(new Font("monospaced", Font.PLAIN, 12)); ta.append(res.toString()); JScrollPane sp = new JScrollPane(ta); frame.add(sp); frame.setVisible(true); FileWriter fw = new FileWriter("/Users/sigmar/file.txt"); fw.write(res.toString()); fw.close(); if (rr != null) rr.run("close"); //} /*if( rr != null ) { rr.run( res ); }*/ } catch (IOException e) { e.printStackTrace(); } /* } }; t2.start();*/ //fr.close(); } catch (IOException e2) { e2.printStackTrace(); } }
From source file:org.wandora.application.gui.topicpanels.ProcessingTopicPanel.java
private void showRichErrorDialog(String msg) { final JTextArea area = new JTextArea(); area.setFont(errorMessageFont); //area.setPreferredSize(new Dimension(520, 180)); area.setEditable(false);//www. j av a 2 s . com area.setText(msg); // Make the JOptionPane resizable using the HierarchyListener area.addHierarchyListener(new HierarchyListener() { public void hierarchyChanged(HierarchyEvent e) { Window window = SwingUtilities.getWindowAncestor(area); if (window instanceof Dialog) { Dialog dialog = (Dialog) window; if (!dialog.isResizable()) { dialog.setResizable(true); } } } }); JScrollPane scroller = new JScrollPane(area); scroller.setPreferredSize(new Dimension(520, 180)); JOptionPane.showMessageDialog(Wandora.getWandora(), scroller, "Errors", JOptionPane.PLAIN_MESSAGE); }
From source file:qic.ui.AboutPanel.java
public AboutPanel() { BoxLayout boxLayout = new BoxLayout(this, BoxLayout.PAGE_AXIS); setLayout(boxLayout);/*from w w w . j av a 2s . com*/ JLabel aboutLbl = new JLabel("<html>" + "<p>Durian Copyright (C) 2015 thirdy</p>" + "<p>This program is free software: you can redistribute it and/or modify</p>" + "<p>it under the terms of the GNU General Public License as published by</p>" + "<p>the Free Software Foundation, either version 3 of the License, or</p>" + "<p>(at your option) any later version.</p>" + "<p>This program comes with ABSOLUTELY NO WARRANTY.</p>" + "<p>A copy of the GNU General Public License can be found at https://github.com/thirdy/durian/blob/master/LICENSE</p>" + "<br/>" + "<br/>" + "<p>Thank you for using Durian. Durian is a fan-made software and is not affiliated with Grinding Gear Games in any way.</p>" + "<p>This software is 100% free and open source.</p>" + "<p>Durian is a fan-made software and is not affiliated with Grinding Gear Games in any way.</p>" + "<br/>" + "<br/>" + "<p>IGN: ManicCompression</p>" + "<p>Reddit: /u/ProFalseIdol</p>" + "</html>"); String websiteUrl = "http://thirdy.github.io/durian/"; JButton website = new JButtonLink("Website: " + websiteUrl, websiteUrl); String forumUrl = "https://www.pathofexile.com/forum/view-thread/1507190"; JButton forum = new JButtonLink("Forum Thread: " + forumUrl, forumUrl); String helpUrl = "http://thirdy.github.io/durian/help/help.htm"; JButton help = new JButtonLink("Search Term Helper: " + helpUrl, helpUrl); add(Box.createRigidArea(new Dimension(5, 10))); add(aboutLbl); add(Box.createRigidArea(new Dimension(5, 10))); add(website); add(Box.createRigidArea(new Dimension(5, 10))); add(forum); add(Box.createRigidArea(new Dimension(5, 10))); add(help); JPanel helpPanel = new JPanel(new BorderLayout()); helpPanel.setBorder(BorderFactory.createTitledBorder("Help")); JTextArea textArea = new JTextArea(); textArea.setFont(new Font(Font.SANS_SERIF, Font.PLAIN, 12)); try { InputStream input = this.getClass().getResource("/help.txt").openStream(); String str = IOUtils.toString(input); textArea.setText(str); textArea.setCaretPosition(0); input.close(); } catch (Exception e) { logger.error("Error while reading help file", e); } helpPanel.add(new JScrollPane(textArea), BorderLayout.CENTER); add(Box.createRigidArea(new Dimension(5, 10))); add(helpPanel); }
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();/*w w w .ja v a 2 s . co m*/ 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:tvbrowser.TVBrowser.java
/** * Entry point of the application//from w w w. ja v a2s . c o m * @param args The arguments given in the command line. */ public static void main(String[] args) { // Read the command line parameters parseCommandline(args); try { Toolkit.getDefaultToolkit().setDynamicLayout( (Boolean) Toolkit.getDefaultToolkit().getDesktopProperty("awt.dynamicLayoutSupported")); } catch (Exception e) { e.printStackTrace(); } mLocalizer = util.ui.Localizer.getLocalizerFor(TVBrowser.class); // Check whether the TV-Browser was started in the right directory if (!new File("imgs").exists()) { String msg = "Please start TV-Browser in the TV-Browser directory!"; if (mLocalizer != null) { msg = mLocalizer.msg("error.2", "Please start TV-Browser in the TV-Browser directory!"); } JOptionPane.showMessageDialog(null, msg); System.exit(1); } if (mIsTransportable) { System.getProperties().remove("propertiesfile"); } // setup logging // Get the default Logger Logger mainLogger = Logger.getLogger(""); // Use a even simpler Formatter for console logging mainLogger.getHandlers()[0].setFormatter(createFormatter()); if (mIsTransportable) { File settingsDir = new File("settings"); try { File test = File.createTempFile("write", "test", settingsDir); test.delete(); } catch (IOException e) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e1) { //ignore } JTextArea area = new JTextArea(mLocalizer.msg("error.noWriteRightsText", "You are using the transportable version of TV-Browser but you have no writing rights in the settings directory:\n\n{0}'\n\nTV-Browser will be closed.", settingsDir.getAbsolutePath())); area.setFont(new JLabel().getFont()); area.setFont(area.getFont().deriveFont((float) 14).deriveFont(Font.BOLD)); area.setLineWrap(true); area.setWrapStyleWord(true); area.setPreferredSize(new Dimension(500, 100)); area.setEditable(false); area.setBorder(null); area.setOpaque(false); JOptionPane.showMessageDialog(null, area, mLocalizer.msg("error.noWriteRightsTitle", "No write rights in settings directory"), JOptionPane.ERROR_MESSAGE); System.exit(1); } } // Load the settings Settings.loadSettings(); Locale.setDefault(new Locale(Settings.propLanguage.getString(), Settings.propCountry.getString())); if (Settings.propFirstStartDate.getDate() == null) { Settings.propFirstStartDate.setDate(Date.getCurrentDate()); } if (!createLockFile()) { updateLookAndFeel(); showTVBrowserIsAlreadyRunningMessageBox(); } String logDirectory = Settings.propLogdirectory.getString(); if (logDirectory != null) { try { File logDir = new File(logDirectory); logDir.mkdirs(); mainLogger.addHandler( new FileLoggingHandler(logDir.getAbsolutePath() + "/tvbrowser.log", createFormatter())); } catch (IOException exc) { String msg = mLocalizer.msg("error.4", "Can't create log file."); ErrorHandler.handle(msg, exc); } } else { // if no logging is configured, show WARNING or worse for normal usage, show everything for unstable versions if (TVBrowser.isStable()) { mainLogger.setLevel(Level.WARNING); } } // log warning for OpenJDK users if (!isJavaImplementationSupported()) { mainLogger.warning(SUN_JAVA_WARNING); } //Update plugin on version change if (Settings.propTVBrowserVersion.getVersion() != null && VERSION.compareTo(Settings.propTVBrowserVersion.getVersion()) > 0) { updateLookAndFeel(); updatePluginsOnVersionChange(); } // Capture unhandled exceptions //System.setErr(new PrintStream(new MonitoringErrorStream())); String timezone = Settings.propTimezone.getString(); if (timezone != null) { TimeZone.setDefault(TimeZone.getTimeZone(timezone)); } mLog.info("Using timezone " + TimeZone.getDefault().getDisplayName()); // refresh the localizers because we know the language now Localizer.emptyLocalizerCache(); mLocalizer = Localizer.getLocalizerFor(TVBrowser.class); ProgramInfo.resetLocalizer(); ReminderPlugin.resetLocalizer(); Date.resetLocalizer(); ProgramFieldType.resetLocalizer(); // Set the proxy settings updateProxySettings(); // Set the String to use for indicating the user agent in http requests System.setProperty("http.agent", MAINWINDOW_TITLE); Version tmpVer = Settings.propTVBrowserVersion.getVersion(); final Version currentVersion = tmpVer != null ? new Version(tmpVer.getMajor(), tmpVer.getMinor(), Settings.propTVBrowserVersionIsStable.getBoolean()) : tmpVer; /*TODO Create an update service for installed TV data services that doesn't * work with TV-Browser 3.0 and updates for them are known. */ if (!isTransportable() && Launch.isOsWindowsNtBranch() && currentVersion != null && currentVersion.compareTo(new Version(3, 0, true)) < 0) { String tvDataDir = Settings.propTVDataDirectory.getString().replace("/", File.separator); if (!tvDataDir.startsWith(System.getenv("appdata"))) { StringBuilder oldDefaultTvDataDir = new StringBuilder(System.getProperty("user.home")) .append(File.separator).append("TV-Browser").append(File.separator).append("tvdata"); if (oldDefaultTvDataDir.toString().equals(tvDataDir)) { Settings.propTVDataDirectory.setString(Settings.propTVDataDirectory.getDefault()); } } } Settings.propTVBrowserVersion.setVersion(VERSION); Settings.propTVBrowserVersionIsStable.setBoolean(VERSION.isStable()); final Splash splash; if (mShowSplashScreen && Settings.propSplashShow.getBoolean()) { splash = new SplashScreen(Settings.propSplashImage.getString(), Settings.propSplashTextPosX.getInt(), Settings.propSplashTextPosY.getInt(), Settings.propSplashForegroundColor.getColor()); } else { splash = new DummySplash(); } splash.showSplash(); /* Initialize the MarkedProgramsList */ MarkedProgramsList.getInstance(); /*Maybe there are tvdataservices to install (.jar.inst files)*/ PluginLoader.getInstance().installPendingPlugins(); PluginLoader.getInstance().loadAllPlugins(); mLog.info("Loading TV listings service..."); splash.setMessage(mLocalizer.msg("splash.dataService", "Loading TV listings service...")); TvDataServiceProxyManager.getInstance().init(); ChannelList.createForTvBrowserStart(); ChannelList.initSubscribedChannels(); if (!lookAndFeelInitialized) { mLog.info("Loading Look&Feel..."); splash.setMessage(mLocalizer.msg("splash.laf", "Loading look and feel...")); updateLookAndFeel(); } mLog.info("Loading plugins..."); splash.setMessage(mLocalizer.msg("splash.plugins", "Loading plugins...")); try { PluginProxyManager.getInstance().init(); } catch (TvBrowserException exc) { ErrorHandler.handle(exc); } splash.setMessage(mLocalizer.msg("splash.tvData", "Checking TV database...")); mLog.info("Checking TV listings inventory..."); TvDataBase.getInstance().checkTvDataInventory(); mLog.info("Starting up..."); splash.setMessage(mLocalizer.msg("splash.ui", "Starting up...")); Toolkit.getDefaultToolkit().getSystemEventQueue().push(new TextComponentPopupEventQueue()); // Init the UI final boolean fStartMinimized = Settings.propMinimizeAfterStartup.getBoolean() || mMinimized; SwingUtilities.invokeLater(new Runnable() { public void run() { initUi(splash, fStartMinimized); new Thread("Start finished callbacks") { public void run() { setPriority(Thread.MIN_PRIORITY); mLog.info("Deleting expired TV listings..."); TvDataBase.getInstance().deleteExpiredFiles(1, false); // first reset "starting" flag of mainframe mainFrame.handleTvBrowserStartFinished(); // initialize program info for fast reaction to program table click ProgramInfo.getInstance().handleTvBrowserStartFinished(); // load reminders and favorites ReminderPlugin.getInstance().handleTvBrowserStartFinished(); FavoritesPlugin.getInstance().handleTvBrowserStartFinished(); // now handle all plugins and services GlobalPluginProgramFormatingManager.getInstance(); PluginProxyManager.getInstance().fireTvBrowserStartFinished(); TvDataServiceProxyManager.getInstance().fireTvBrowserStartFinished(); // finally submit plugin caused updates to database TvDataBase.getInstance().handleTvBrowserStartFinished(); startPeriodicSaveSettings(); } }.start(); SwingUtilities.invokeLater(new Runnable() { public void run() { ChannelList.completeChannelLoading(); initializeAutomaticDownload(); if (Launch.isOsWindowsNtBranch()) { try { RegistryKey desktopSettings = new RegistryKey(RootKey.HKEY_CURRENT_USER, "Control Panel\\Desktop"); RegistryValue autoEnd = desktopSettings.getValue("AutoEndTasks"); if (autoEnd.getData().equals("1")) { RegistryValue killWait = desktopSettings.getValue("WaitToKillAppTimeout"); int i = Integer.parseInt(killWait.getData().toString()); if (i < 5000) { JOptionPane pane = new JOptionPane(); String cancel = mLocalizer.msg("registryCancel", "Close TV-Browser"); String dontDoIt = mLocalizer.msg("registryJumpOver", "Not this time"); pane.setOptions(new String[] { Localizer.getLocalization(Localizer.I18N_OK), dontDoIt, cancel }); pane.setOptionType(JOptionPane.YES_NO_CANCEL_OPTION); pane.setMessageType(JOptionPane.WARNING_MESSAGE); pane.setMessage(mLocalizer.msg("registryWarning", "The fast shutdown of Windows is activated.\nThe timeout to wait for before Windows is closing an application is too short,\nto give TV-Browser enough time to save all settings.\n\nThe setting hasn't the default value. It was changed by a tool or by you.\nTV-Browser will now try to change the timeout.\n\nIf you don't want to change this timeout select 'Not this time' or 'Close TV-Browser'.")); pane.setInitialValue(mLocalizer.msg("registryCancel", "Close TV-Browser")); JDialog d = pane.createDialog(UiUtilities.getLastModalChildOf(mainFrame), UIManager.getString("OptionPane.messageDialogTitle")); d.setModal(true); UiUtilities.centerAndShow(d); if (pane.getValue() == null || pane.getValue().equals(cancel)) { mainFrame.quit(); } else if (!pane.getValue().equals(dontDoIt)) { try { killWait.setData("5000"); desktopSettings.setValue(killWait); JOptionPane.showMessageDialog( UiUtilities.getLastModalChildOf(mainFrame), mLocalizer.msg("registryChanged", "The timeout was changed successfully.\nPlease reboot Windows!")); } catch (Exception registySetting) { JOptionPane.showMessageDialog( UiUtilities.getLastModalChildOf(mainFrame), mLocalizer.msg("registryNotChanged", "<html>The Registry value couldn't be changed. Maybe you haven't the right to do it.<br>If it is so contact you Administrator and let him do it for you.<br><br><b><Attention:/b> The following description is for experts. If you change or delete the wrong value in the Registry you could destroy your Windows installation.<br><br>To get no warning on TV-Browser start the Registry value <b>WaitToKillAppTimeout</b> in the Registry path<br><b>HKEY_CURRENT_USER\\Control Panel\\Desktop</b> have to be at least <b>5000</b> or the value for <b>AutoEndTasks</b> in the same path have to be <b>0</b>.</html>"), Localizer.getLocalization(Localizer.I18N_ERROR), JOptionPane.ERROR_MESSAGE); } } } } } catch (Throwable registry) { } } if (currentVersion != null && currentVersion.compareTo(new Version(2, 71, false)) < 0) { if (Settings.propProgramPanelMarkedMinPriorityColor.getColor() .equals(Settings.propProgramPanelMarkedMinPriorityColor.getDefaultColor())) { Settings.propProgramPanelMarkedMinPriorityColor.setColor(new Color(255, 0, 0, 30)); } if (Settings.propProgramPanelMarkedMediumPriorityColor.getColor() .equals(Settings.propProgramPanelMarkedMediumPriorityColor.getDefaultColor())) { Settings.propProgramPanelMarkedMediumPriorityColor .setColor(new Color(140, 255, 0, 60)); } if (Settings.propProgramPanelMarkedHigherMediumPriorityColor.getColor().equals( Settings.propProgramPanelMarkedHigherMediumPriorityColor.getDefaultColor())) { Settings.propProgramPanelMarkedHigherMediumPriorityColor .setColor(new Color(255, 255, 0, 60)); } if (Settings.propProgramPanelMarkedMaxPriorityColor.getColor() .equals(Settings.propProgramPanelMarkedMaxPriorityColor.getDefaultColor())) { Settings.propProgramPanelMarkedMaxPriorityColor .setColor(new Color(255, 180, 0, 110)); } } // check if user should select picture settings if (currentVersion != null && currentVersion.compareTo(new Version(2, 22)) < 0) { TvBrowserPictureSettingsUpdateDialog.createAndShow(mainFrame); } else if (currentVersion != null && currentVersion.compareTo(new Version(2, 51, true)) < 0) { Settings.propAcceptedLicenseArrForServiceIds.setStringArray(new String[0]); } if (currentVersion != null && currentVersion.compareTo(new Version(2, 60, true)) < 0) { int startOfDay = Settings.propProgramTableStartOfDay.getInt(); int endOfDay = Settings.propProgramTableEndOfDay.getInt(); if (endOfDay - startOfDay < -1) { Settings.propProgramTableEndOfDay.setInt(startOfDay); JOptionPane.showMessageDialog(UiUtilities.getLastModalChildOf(mainFrame), mLocalizer.msg("timeInfoText", "The time range of the program table was corrected because the defined day was shorter than 24 hours.\n\nIf the program table should show less than 24h use a time filter for that. That time filter can be selected\nto be the default filter by selecting it in the filter settings and pressing on the button 'Default'."), mLocalizer.msg("timeInfoTitle", "Times corrected"), JOptionPane.INFORMATION_MESSAGE); Settings.handleChangedSettings(); } } MainFrame.getInstance().getProgramTableScrollPane().requestFocusInWindow(); } }); } }); // register the shutdown hook Runtime.getRuntime().addShutdownHook(new Thread("Shutdown hook") { public void run() { deleteLockFile(); MainFrame.getInstance().quit(false); } }); }