public static void checkVersion() throws InterruptedException { System.out.println( "PlantUML version " + Version.versionString() + " (" + new Date(Version.compileTime()) + ")"); System.out.println(); final int lastversion = PSystemVersion.extractDownloadableVersion(null, null); if (lastversion == -1) { System.out.println("Error"); System.out.println("Cannot connect to http://plantuml.sourceforge.net/"); System.out.println("Maybe you should set your proxy ?"); } else if (lastversion == 0) { System.out.println("Error"); System.out.println("Cannot retrieve last version from http://plantuml.sourceforge.net/"); } else { System.out.println("Last available version for download : " + lastversion); System.out.println(); if (Version.version() >= lastversion) { System.out.println("Your version is up to date."); } else { System.out.println("A newer version is available for download."); } } exit(); }
public MainWindow2(Option option, File arg) { super(getDirectory(arg).getAbsolutePath()); final File dir = getDirectory(arg); setIconImage(PSystemVersion.getPlantumlSmallIcon2()); this.option = option; dirWatcher = new DirWatcher2(dir, option, getRegexpPattern(getExtensions())); Log.info("Showing MainWindow"); scrollPane = new JScrollPane(jList1); scrollPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); final JPanel south = new JPanel(new BorderLayout()); final JLabel labelFileExtensions = new JLabel("File extensions: "); extensions.setText(getExtensions()); labelFileExtensions.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); CompoundBorder border = BorderFactory.createCompoundBorder( BorderFactory.createEmptyBorder(10, 10, 10, 10), BorderFactory.createEtchedBorder()); border = BorderFactory.createCompoundBorder(border, BorderFactory.createEmptyBorder(5, 5, 5, 5)); south.setBorder(border); south.add(labelFileExtensions, BorderLayout.WEST); south.add(extensions, BorderLayout.CENTER); south.add(changeDirButton, BorderLayout.SOUTH); getContentPane().add(south, BorderLayout.SOUTH); getContentPane().add(scrollPane, BorderLayout.CENTER); final MouseListener mouseListener = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { if (e.getClickCount() == 2) { final int index = jList1.locationToIndex(e.getPoint()); doubleClick( (SimpleLine2) jList1.getModel().getElementAt(index), jList1.getModel(), index); } } catch (Exception ex) { } } }; jList1.addMouseListener(mouseListener); changeDirButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { System.err.println("Opening Directory Window"); displayDialogChangeDir(); } }); jList1.addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { final int index = jList1.getSelectedIndex(); doubleClick( (SimpleLine2) jList1.getModel().getElementAt(index), jList1.getModel(), index); } } }); extensions.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { changeExtensions(extensions.getText()); } }); extensions.addFocusListener( new FocusListener() { public void focusGained(FocusEvent e) {} public void focusLost(FocusEvent e) { changeExtensions(extensions.getText()); } }); final JMenuBar menuBar = new JMenuBar(); final JMenu mFile = new JMenu("File"); menuBar.add(mFile); setJMenuBar(menuBar); final JMenuItem sprite = new JMenuItem("Open Sprite Window"); mFile.add(sprite); sprite.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { new SpriteWindow(); } }); final JMenuItem about = new JMenuItem("About"); mFile.add(about); about.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { new AboutWindow(); } }); final JMenuItem exit = new JMenuItem("Exit"); mFile.add(exit); exit.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent e) { System.exit(0); } }); setSize(640, 400); this.setLocationRelativeTo(this.getParent()); setVisible(true); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); startTimer(); }