void printButton_actionPerformed(ActionEvent e) { DetailSaleDocVO vo = (DetailSaleDocVO) headerFormPanel.getVOModel().getValueObject(); HashMap params = new HashMap(); params.put("COMPANY_CODE", vo.getCompanyCodeSys01DOC01()); params.put("DOC_TYPE", vo.getDocTypeDOC01()); params.put("DOC_YEAR", vo.getDocYearDOC01()); params.put("DOC_NUMBER", vo.getDocNumberDOC01()); HashMap map = new HashMap(); map.put(ApplicationConsts.COMPANY_CODE_SYS01, vo.getCompanyCodeSys01DOC01()); map.put(ApplicationConsts.FUNCTION_CODE_SYS06, headerFormPanel.getFunctionId()); map.put(ApplicationConsts.EXPORT_PARAMS, params); Response res = ClientUtils.getData("getJasperReport", map); if (!res.isError()) { JasperPrint print = (JasperPrint) ((VOResponse) res).getVo(); JRViewer viewer = new JRViewer(print); JFrame frame = new JFrame(); frame.setSize(MDIFrame.getInstance().getSize()); frame.setContentPane(viewer); frame.setTitle(this.getTitle()); frame.setIconImage(MDIFrame.getInstance().getIconImage()); frame.setVisible(true); } else JOptionPane.showMessageDialog( ClientUtils.getParentFrame(this), res.getErrorMessage(), ClientSettings.getInstance().getResources().getResource("print document"), JOptionPane.ERROR_MESSAGE); }
/** This method sets up the window and displays it. */ private void setupFrame() { JFrame window = new JFrame("Dungeon of Dooom"); window.setIconImage(Toolkit.getDefaultToolkit().getImage("graphics/icon.png")); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); populateFrame(window.getContentPane()); window.pack(); window.setLocationByPlatform(true); window.setVisible(true); Dimension windowSize = new Dimension(608, 606); window.setSize(windowSize); window.setResizable(false); }
void printButton_actionPerformed(ActionEvent e) { if (controlFromDate.getValue() == null || controlToDate.getValue() == null) { JOptionPane.showMessageDialog( ClientUtils.getParentFrame(this), ClientSettings.getInstance().getResources().getResource("please set a from/to date"), ClientSettings.getInstance().getResources().getResource("Attention"), JOptionPane.WARNING_MESSAGE); return; } if (controlCompaniesCombo.getValue() == null) { JOptionPane.showMessageDialog( ClientUtils.getParentFrame(this), ClientSettings.getInstance().getResources().getResource("please select a company"), ClientSettings.getInstance().getResources().getResource("Attention"), JOptionPane.WARNING_MESSAGE); return; } HashMap params = new HashMap(); params.put("COMPANY_CODE", controlCompaniesCombo.getValue()); params.put("START_DATE", controlFromDate.getValue()); params.put("END_DATE", controlToDate.getValue()); if (controlFromItemNr.getValue() != null) params.put( "FROM_PROGRESSIVE", " and ACC05_JOURNAL_HEADER.PROGRESSIVE>=" + controlFromItemNr.getValue()); else params.remove("FROM_PROGRESSIVE"); HashMap map = new HashMap(); map.put(ApplicationConsts.COMPANY_CODE_SYS01, controlCompaniesCombo.getValue()); map.put(ApplicationConsts.FUNCTION_CODE_SYS06, "ACC05"); map.put(ApplicationConsts.EXPORT_PARAMS, params); Response res = ClientUtils.getData("getJasperReport", map); if (!res.isError()) { JasperPrint print = (JasperPrint) ((VOResponse) res).getVo(); JRViewer viewer = new JRViewer(print); JFrame frame = new JFrame(); frame.setSize(MDIFrame.getInstance().getSize()); frame.setContentPane(viewer); frame.setTitle(this.getTitle()); frame.setIconImage(MDIFrame.getInstance().getIconImage()); frame.setVisible(true); } else JOptionPane.showMessageDialog( ClientUtils.getParentFrame(this), res.getErrorMessage(), ClientSettings.getInstance().getResources().getResource("print journal"), JOptionPane.ERROR_MESSAGE); }
public Fenetre() { frame = new JFrame(); frame.setTitle("Gestion Sauvegarde Serveur"); frame.setSize(700, 600); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setIconImage( Toolkit.getDefaultToolkit().getImage(getClass().getResource("/go-home.png"))); frame.setResizable(true); frame.setLocationRelativeTo(null); frame.setUndecorated(false); frame.setBackground(Color.white); frame.setContentPane(contentPane()); frame.setVisible(true); }
public static void main(String s[]) { JFrame frame = new JFrame("Exportator"); AppExport panel = new AppExport(); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); Image im = Toolkit.getDefaultToolkit().getImage("images/ExportIco.jpg"); frame.setIconImage(im); frame.getContentPane().add(panel, "Center"); frame.setSize(panel.getPreferredSize()); frame.setVisible(true); frame.setResizable(false); frame.setLocationRelativeTo(null); }
public reminder(int m, int y, int m3, int y3) { m1 = m; y1 = y; m2 = m3; y2 = y3; try { f.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("skrm.jpg"))); String cn = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(cn); // Use the native L&F } catch (Exception cnf) { System.out.println(cnf); } f = new JFrame("Print Reminders"); f.setVisible(true); f.setLayout(null); f.setSize(300, 100); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); b = new JButton("Print Reminders"); b.addActionListener(this); back = new JButton("Back"); back.addActionListener(this); f.add(b); b.setBounds(10, 10, 100, 20); b.setMnemonic('P'); f.add(back); back.setMnemonic('B'); back.setBounds(150, 10, 100, 20); // f.pack(); }
private static void constructFrame() { final JFrame lFrame = new JFrame((String) viewModel.get("string.title")); lFrame.setIconImage((Image) viewModel.get("image.crab")); // Install the closing mechanism on the frame when the user // wants to close the frame by clicking the X button. lFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); lFrame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { final ExitAction lExitAction = (ExitAction) viewModel.get("action.exit"); if (lExitAction != null) { // If there is an exit action defined, we use this action. // It will have the same effect as calling the exit menu item. lExitAction.actionPerformed(new ActionEvent(lFrame, 0, "exit")); } else { // If the exit action is not available, we will close the frame anyhow. lFrame.dispose(); } } }); // Calculate the middle of the screen. final Rectangle lScreenRect = GraphicsEnvironment.getLocalGraphicsEnvironment() .getDefaultScreenDevice() .getDefaultConfiguration() .getBounds(); // Using the 'golden ratio' 1.618 for the width/height ratio. final Rectangle lFrameRect = new Rectangle(Math.min(647, lScreenRect.width), Math.min(400, lScreenRect.height)); // Set the window size and location. lFrame.setLocation( (lScreenRect.width - lFrameRect.width) / 2, (lScreenRect.height - lFrameRect.height) / 2); lFrame.setSize(lFrameRect.width, lFrameRect.height); viewModel.put("window.frame", lFrame); }
public static void main(String args[]) throws HTTPException { // prefs storage try { String prefStore = ucar.util.prefs.XMLStore.makeStandardFilename(".unidata", "TdsMonitor.xml"); store = ucar.util.prefs.XMLStore.createFromFile(prefStore, null); prefs = store.getPreferences(); Debug.setStore(prefs.node("Debug")); } catch (IOException e) { System.out.println("XMLStore Creation failed " + e); } // initializations BAMutil.setResourcePath("/resources/nj22/ui/icons/"); // put UI in a JFrame frame = new JFrame("TDS Monitor"); ui = new TdsMonitor(prefs, frame); frame.setIconImage(BAMutil.getImage("netcdfUI")); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { if (!done) ui.exit(); } }); frame.getContentPane().add(ui); Rectangle bounds = (Rectangle) prefs.getBean(FRAME_SIZE, new Rectangle(50, 50, 800, 450)); frame.setBounds(bounds); frame.pack(); frame.setBounds(bounds); frame.setVisible(true); }
public Ssys3() { store = new Storage(); tableSorter = new TableRowSorter<Storage>(store); jobs = new LinkedList<String>(); makeGUI(); frm.setSize(800, 600); frm.addWindowListener( new WindowListener() { public void windowActivated(WindowEvent evt) {} public void windowClosed(WindowEvent evt) { try { System.out.println("joining EDT's"); for (EDT edt : encryptDecryptThreads) { edt.weakStop(); try { edt.join(); System.out.println(" - joined"); } catch (InterruptedException e) { System.out.println(" - Not joined"); } } System.out.println("saving storage"); store.saveAll(tempLoc); } catch (IOException e) { e.printStackTrace(); System.err.println( "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\nFailed to save properly\n\n!!!!!!!!!!!!!!!!!!!!!!!!!"); System.exit(1); } clean(); System.exit(0); } public void windowClosing(WindowEvent evt) { windowClosed(evt); } public void windowDeactivated(WindowEvent evt) {} public void windowDeiconified(WindowEvent evt) {} public void windowIconified(WindowEvent evt) {} public void windowOpened(WindowEvent evt) {} }); ImageIcon ico = new ImageIcon(ICON_NAME); frm.setIconImage(ico.getImage()); frm.setLocationRelativeTo(null); frm.setVisible(true); // load config storeLocs = new ArrayList<File>(); String ossl = "openssl"; int numThreadTemp = 2; boolean priorityDecryptTemp = true; boolean allowExportTemp = false; boolean checkImportTemp = true; try { Scanner sca = new Scanner(CONF_FILE); while (sca.hasNextLine()) { String ln = sca.nextLine(); if (ln.startsWith(CONF_SSL)) { ossl = ln.substring(CONF_SSL.length()); } else if (ln.startsWith(CONF_THREAD)) { try { numThreadTemp = Integer.parseInt(ln.substring(CONF_THREAD.length())); } catch (Exception exc) { // do Nothing } } else if (ln.equals(CONF_STORE)) { while (sca.hasNextLine()) storeLocs.add(new File(sca.nextLine())); } else if (ln.startsWith(CONF_PRIORITY)) { try { priorityDecryptTemp = Boolean.parseBoolean(ln.substring(CONF_PRIORITY.length())); } catch (Exception exc) { // do Nothing } } else if (ln.startsWith(CONF_EXPORT)) { try { allowExportTemp = Boolean.parseBoolean(ln.substring(CONF_EXPORT.length())); } catch (Exception exc) { // do Nothing } } else if (ln.startsWith(CONF_CONFIRM)) { try { checkImportTemp = Boolean.parseBoolean(ln.substring(CONF_CONFIRM.length())); } catch (Exception exc) { // do Nothing } } } sca.close(); } catch (IOException e) { } String osslWorks = OpenSSLCommander.test(ossl); while (osslWorks == null) { ossl = JOptionPane.showInputDialog( frm, "Please input the command used to run open ssl\n We will run \"<command> version\" to confirm\n Previous command: " + ossl, "Find open ssl", JOptionPane.OK_CANCEL_OPTION); if (ossl == null) { System.err.println("Refused to provide openssl executable location"); System.exit(1); } osslWorks = OpenSSLCommander.test(ossl); if (osslWorks == null) JOptionPane.showMessageDialog( frm, "Command " + ossl + " unsuccessful", "Unsuccessful", JOptionPane.ERROR_MESSAGE); } if (storeLocs.size() < 1) JOptionPane.showMessageDialog( frm, "Please select an initial sotrage location\nIf one already exists, or there are more than one, please select it"); while (storeLocs.size() < 1) { JFileChooser jfc = new JFileChooser(); jfc.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); if (jfc.showOpenDialog(frm) != JFileChooser.APPROVE_OPTION) { System.err.println("Refused to provide an initial store folder"); System.exit(1); } File sel = jfc.getSelectedFile(); if (sel.isDirectory()) storeLocs.add(sel); } numThreads = numThreadTemp; priorityExport = priorityDecryptTemp; allowExport = allowExportTemp; checkImports = checkImportTemp; try { PrintWriter pw = new PrintWriter(CONF_FILE); pw.println(CONF_SSL + ossl); pw.println(CONF_THREAD + numThreads); pw.println(CONF_PRIORITY + priorityExport); pw.println(CONF_EXPORT + allowExport); pw.println(CONF_CONFIRM + checkImports); pw.println(CONF_STORE); for (File fi : storeLocs) { pw.println(fi.getAbsolutePath()); } pw.close(); } catch (IOException e) { System.err.println("Failed to save config"); } File chk = null; for (File fi : storeLocs) { File lib = new File(fi, LIBRARY_NAME); if (lib.exists()) { chk = lib; // break; } } char[] pass = null; if (chk == null) { JOptionPane.showMessageDialog( frm, "First time run\n Create your password", "Create Password", JOptionPane.INFORMATION_MESSAGE); char[] p1 = askPassword(); char[] p2 = askPassword(); boolean same = p1.length == p2.length; for (int i = 0; i < Math.min(p1.length, p2.length); i++) { if (p1[i] != p2[i]) same = false; } if (same) { JOptionPane.showMessageDialog( frm, "Password created", "Create Password", JOptionPane.INFORMATION_MESSAGE); pass = p1; } else { JOptionPane.showMessageDialog( frm, "Passwords dont match", "Create Password", JOptionPane.ERROR_MESSAGE); System.exit(1); } } else { pass = askPassword(); } sec = OpenSSLCommander.getCommander(chk, pass, ossl); if (sec == null) { System.err.println("Wrong Password"); System.exit(1); } store.useSecurity(sec); store.useStorage(storeLocs); tempLoc = new File("temp"); if (!tempLoc.exists()) tempLoc.mkdirs(); // load stores try { store.loadAll(tempLoc); store.fireTableDataChanged(); } catch (IOException e) { System.err.println("Storage loading failure"); System.exit(1); } needsSave = false; encryptDecryptThreads = new EDT[numThreads]; for (int i = 0; i < encryptDecryptThreads.length; i++) { encryptDecryptThreads[i] = new EDT(i); encryptDecryptThreads[i].start(); } updateStatus(); txaSearch.grabFocus(); }
public ShowResults(SharkPanel _sp, String _files[], double _scores[], int _nrpairs[]) { sp = _sp; files = _files; scores = _scores; nrpairs = _nrpairs; LogFile lf = new LogFile("SearchResults_"); DefaultListModel listModel = new DefaultListModel(); for (int i = 0; i < files.length; i++) { GetImageFile gif = new GetImageFile(files[i]); Integer ii = new Integer(_nrpairs[i]); int tmpval = (int) (1000.0 * _scores[i]); Double dd = new Double((double) tmpval / 1000.0); String tmp = gif.getImageString(); String s = tmp.substring(tmp.lastIndexOf('\\') + 1, tmp.length()) + "\t" + ii.toString() + "\t" + dd.toString(); String ddval = dd.toString(); while (ddval.length() < 5) ddval += "0"; if (i < 9) listModel.addElement( " " + (i + 1) + ". " + ddval + " " + tmp.substring(tmp.lastIndexOf('\\') + 1, tmp.length())); else listModel.addElement( (i + 1) + ". " + ddval + " " + tmp.substring(tmp.lastIndexOf('\\') + 1, tmp.length())); lf.write(s); } lf.close(); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); list = new JList(listModel); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); list.setDragEnabled(false); list.addMouseListener(new MouseClickListener()); JScrollPane listView = new JScrollPane(list); listView.setPreferredSize(new Dimension(250, 250)); showButton = new JButton("Visual comparison"); showButton.addActionListener(this); showButton.setMnemonic('V'); showButton.setEnabled(false); JButton closeButton = new JButton("Close"); closeButton.addActionListener(this); closeButton.setMnemonic('C'); JPanel panel = new JPanel(); panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS)); panel.add(listView, BorderLayout.CENTER); panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); JPanel panel2 = new JPanel(); panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS)); panel2.add(showButton); panel2.add(Box.createRigidArea(new Dimension(10, 1))); panel2.add(closeButton); add(panel); add(Box.createRigidArea(new Dimension(1, 10))); add(panel2); if (frame != null) frame.dispose(); frame = new JFrame("I3S: Search results"); frame.setContentPane(this); frame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent e) { frame.dispose(); frame = null; } }); frame.setSize(new Dimension(400, 300)); frame.setLocation(200, 200); ImageIcon imageIcon = new ImageIcon(this.getClass().getResource("/Simages/icon.gif")); frame.setIconImage(imageIcon.getImage()); frame.pack(); frame.setVisible(true); }
public void initUI() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); JPopupMenu.setDefaultLightWeightPopupEnabled(false); frame = new JFrame("Vestige-x Developers Client"); frame.setIconImage( Toolkit.getDefaultToolkit().getImage(signlink.findcachedir() + "Cursor.png")); frame.setLayout(new BorderLayout()); frame.setResizable(false); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel gamePanel = new JPanel(); gamePanel.setLayout(new BorderLayout()); gamePanel.add(this); Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); int w = 765; int h = 503; int x = (dim.width - w) / 2; int y = (dim.height - h) / 2; frame.setLocation(x, y); gamePanel.setPreferredSize(new Dimension(765, 503)); JMenu fileMenu = new JMenu(" File "); JMenu toolMenu = new JMenu(" Tools "); JMenu infoMenu = new JMenu(" Info "); JMenu toggleMenu = new JMenu(" Toggles "); JMenu profileMenu = new JMenu(" Links "); JButton shotMenu = new JButton("Take Screenshot"); shotMenu.setActionCommand("Screenshot"); shotMenu.addActionListener(this); String[] mainButtons = new String[] {"View Images", "Exit"}; String[] toolButtons = new String[] {"World Map"}; String[] infoButtons = new String[] {"Client Information", "Support"}; String[] toggleButtons = new String[] {"Toggle 10x Damage", "Untoggle 10x Damage"}; String[] profileButtons = new String[] {"Donate", "Vote", "-", "Highscores", "Guides", "YouTube", "Forums"}; for (String name : mainButtons) { JMenuItem menuItem = new JMenuItem(name); if (name.equalsIgnoreCase("-")) { fileMenu.addSeparator(); } else { menuItem.addActionListener(this); fileMenu.add(menuItem); } } for (String name : toolButtons) { JMenuItem menuItem = new JMenuItem(name); if (name.equalsIgnoreCase("-")) toolMenu.addSeparator(); else { menuItem.addActionListener(this); toolMenu.add(menuItem); } } for (String name : infoButtons) { JMenuItem menuItem = new JMenuItem(name); if (name.equalsIgnoreCase("-")) infoMenu.addSeparator(); else { menuItem.addActionListener(this); infoMenu.add(menuItem); } } for (String name : toggleButtons) { JMenuItem menuItem = new JMenuItem(name); if (name.equalsIgnoreCase("-")) toggleMenu.addSeparator(); else { menuItem.addActionListener(this); toggleMenu.add(menuItem); } } for (String name : profileButtons) { JMenuItem menuItem = new JMenuItem(name); if (name.equalsIgnoreCase("-")) toggleMenu.addSeparator(); else { menuItem.addActionListener(this); profileMenu.add(menuItem); } } JMenuBar menuBar = new JMenuBar(); JMenuBar jmenubar = new JMenuBar(); frame.add(jmenubar); menuBar.add(fileMenu); menuBar.add(toolMenu); menuBar.add(infoMenu); // menuBar.add(toggleMenu); menuBar.add(profileMenu); menuBar.add(shotMenu); frame.getContentPane().add(menuBar, BorderLayout.NORTH); frame.getContentPane().add(gamePanel, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); // can see the client frame.setResizable(false); // resizeable frame init(); } catch (Exception e) { e.printStackTrace(); } }
void main() { CommonSwing.setDefaultColor(); fMain = new JFrame("HSQL Database Manager"); // (ulrivo): An actual icon. fMain.getContentPane().add(createToolBar(), "North"); fMain.setIconImage(CommonSwing.getIcon()); fMain.addWindowListener(this); JMenuBar bar = new JMenuBar(); // used shortcuts: CERGTSIUDOLM String fitems[] = { "-Connect...", "--", "-Open Script...", "-Save Script...", "-Save Result...", "--", "-Exit" }; addMenu(bar, "File", fitems); String vitems[] = {"RRefresh Tree", "--", "GResults in Grid", "TResults in Text"}; addMenu(bar, "View", vitems); String sitems[] = { "SSELECT", "IINSERT", "UUPDATE", "DDELETE", "---", "-CREATE TABLE", "-DROP TABLE", "-CREATE INDEX", "-DROP INDEX", "--", "-CHECKPOINT", "-SCRIPT", "-SET", "-SHUTDOWN", "--", "-Test Script" }; addMenu(bar, "Command", sitems); mRecent = new JMenu("Recent"); bar.add(mRecent); String soptions[] = { "-AutoCommit on", "-AutoCommit off", "OCommit", "LRollback", "--", "-Disable MaxRows", "-Set MaxRows to 100", "--", "-Logging on", "-Logging off", "--", "-Insert test data" }; addMenu(bar, "Options", soptions); String stools[] = {"-Dump", "-Restore", "-Transfer"}; addMenu(bar, "Tools", stools); fMain.setJMenuBar(bar); initGUI(); sRecent = new String[iMaxRecent]; Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); Dimension size = fMain.getSize(); // (ulrivo): full size on screen with less than 640 width if (d.width >= 640) { fMain.setLocation((d.width - size.width) / 2, (d.height - size.height) / 2); } else { fMain.setLocation(0, 0); fMain.setSize(d); } fMain.show(); // (ulrivo): load query from command line if (defScript != null) { if (defDirectory != null) { defScript = defDirectory + File.separator + defScript; } // if insert stmet is thousands of records...skip showing it // as text. Too huge. StringBuffer buf = new StringBuffer(); ifHuge = DatabaseManagerCommon.readFile(defScript); if (4096 <= ifHuge.length()) { buf.append("This huge file cannot be edited. Please execute\n"); txtCommand.setText(buf.toString()); } else { txtCommand.setText(ifHuge); } } txtCommand.requestFocus(); }