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); }
public static void main(String[] args) { Example4 ef = new Example4(); try { final String molS = "C1C2=CC=CC=C2C3=C4CC5=CC=CC=C5C4=C6CC7=CC=CC=C7C6=C13"; Molecule mol = MolImporter.importMol(molS); PolarizabilityPlugin plugin = new PolarizabilityPlugin(); plugin.setMolecule(mol); plugin.run(); ArrayList values = new ArrayList(); java.text.NumberFormat nf = java.text.NumberFormat.getInstance(); nf.setMaximumFractionDigits(3); for (int i = 0; i < mol.getAtomCount(); i++) { values.add(Float.valueOf(nf.format(((Double) plugin.getResult(i)).floatValue()))); } mol.hydrogenize(true); for (int i = 0; i < mol.getExplicitHcount(); i++) { values.add(new Double(0)); } ef.setPlugin(plugin); JFrame frame = ef.createSpaceFrame(mol, values); frame.setTitle("Polarizability"); java.net.URL u = ef.getClass().getResource("/chemaxon/marvin/space/gui/mspace16.gif"); frame.setIconImage( Toolkit.getDefaultToolkit().createImage((java.awt.image.ImageProducer) u.getContent())); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } }
public static void main(String[] args) { JFrame frame = new JFrame(GAME_TITLE); game = new Game(WIDTH, HEIGHT); frame.add(BorderLayout.CENTER, game); frame.pack(); frame.setVisible(true); frame.setResizable(false); frame.setIconImage(Resources.iconimage); }
/** 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); }
private void buildMainFrame() { DesktopContext context = getDesktopContext(); mainFrame = new JFrame(PRIDE_GUI + " " + context.getProperty("pride.inspector.version")); ImageIcon icon = GUIUtilities.loadImageIcon(context.getProperty("pride.inspector.logo.medium.icon")); mainFrame.setIconImage(icon.getImage()); try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { logger.error("Failed to set the look and feel", e); } // ToDo: proper exit hooke mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); }
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 static void main(String[] args) { JFrame frame = new JFrame("Demo of Additional Borders"); frame.setIconImage(JideIconsFactory.getImageIcon(JideIconsFactory.JIDE32).getImage()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.getContentPane().setLayout(new BorderLayout()); JPanel panel = new JPanel(); panel.setBorder(BorderFactory.createEmptyBorder(20, 20, 20, 20)); panel.setLayout(new JideBoxLayout(panel, JideBoxLayout.Y_AXIS, 10)); JTextArea textField = new JTextArea(); JPanel border = new JPanel(new BorderLayout()); border.setPreferredSize(new Dimension(100, 100)); border.add(new JScrollPane(textField), BorderLayout.CENTER); border.setBorder( new JideTitledBorder( new PartialEtchedBorder(PartialEtchedBorder.LOWERED, PartialSide.NORTH), "PartialEtchedBorder")); JTextArea textField2 = new JTextArea(); JPanel border2 = new JPanel(new BorderLayout()); border2.setPreferredSize(new Dimension(100, 100)); border2.add(new JScrollPane(textField2), BorderLayout.CENTER); border2.setBorder( new JideTitledBorder( new PartialLineBorder(Color.darkGray, 1, PartialSide.NORTH), "PartialLineBorder")); JTextArea textField3 = new JTextArea(); JPanel border3 = new JPanel(new BorderLayout()); border3.setPreferredSize(new Dimension(100, 100)); border3.add(new JScrollPane(textField3), BorderLayout.CENTER); border3.setBorder( BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder( new PartialLineBorder(Color.gray, 1, true), "Rounded Corners Border"), BorderFactory.createEmptyBorder(0, 6, 4, 6))); panel.add(border, JideBoxLayout.FLEXIBLE); panel.add(Box.createVerticalStrut(12)); panel.add(border2, JideBoxLayout.FLEXIBLE); panel.add(Box.createVerticalStrut(12)); panel.add(border3, JideBoxLayout.FLEXIBLE); panel.add(Box.createGlue(), JideBoxLayout.VARY); panel.setPreferredSize(new Dimension(500, 400)); frame.getContentPane().add(panel, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); }
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 BSInterface() { mainFrame.setSize(960, 720); mainFrame.setResizable(false); mainFrame.setIconImage(Toolkit.getDefaultToolkit().createImage("pic/ticket_16.png")); Container contentPane = mainFrame.getContentPane(); contentPane.setLayout(new BorderLayout()); contentPane.add(toolPanel, BorderLayout.NORTH); contentPane.add(operPanel, BorderLayout.CENTER); mainFrame.setContentPane(contentPane); mainFrame.setVisible(true); mainFrame.addWindowListener( new WindowAdapter() { public void windowClosing(WindowEvent we) { // device_close(); System.exit(0); } }); }
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(); }
ChatClientGUI(String ip, int port) { super("Peep Chat"); try { super.setIconImage(ImageIO.read((new File("icon/peep.png")))); } catch (IOException e) { } IP = ip; PORT = port; try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e) { } catch (InstantiationException e) { } catch (IllegalAccessException e) { } catch (UnsupportedLookAndFeelException e) { } setPreferredSize(new Dimension(800, 700)); addWindowListener(this); setupConsole(); setupUsernameRequestView(); CHAT_CLIENT = new ChatClient(IP, PORT, this); }
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); }
// swing gui / constructor public Main(final Field f) { super("Sudoku Solver"); URL iconURL = getClass().getResource("icon.png"); ImageIcon img = new ImageIcon(iconURL); jFrame.setIconImage(img.getImage()); Color darkBlue = new Color(51, 102, 153); Color lightBlue = new Color(18, 61, 104); grid = new JTextField[9][9]; jGrid.setLayout(new GridLayout(9, 9)); jGrid.setBorder(BorderFactory.createMatteBorder(5, 5, 5, 5, darkBlue)); jGrid.setBackground(darkBlue); for (int i = 0; i < 9; i++) { for (int j = 0; j < 9; j++) { grid[i][j] = new JTextField(); grid[i][j].setDocument(new JTextFieldLimit(1)); grid[i][j].setFont(new Font("Arial", Font.PLAIN, 20)); grid[i][j].setHorizontalAlignment(JTextField.CENTER); grid[i][j].setText(""); grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 1, 1, lightBlue)); if (j == 2 || j == 5) { grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 1, 5, lightBlue)); } if (i == 2 || i == 5) { grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 1, lightBlue)); } if (i == 2 && j == 2) { grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, lightBlue)); } if (i == 5 && j == 2) { grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, lightBlue)); } if (i == 2 && j == 5) { grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, lightBlue)); } if (i == 5 && j == 5) { grid[i][j].setBorder(BorderFactory.createMatteBorder(1, 1, 5, 5, lightBlue)); } jGrid.add(grid[i][j]); } } jButton.setLayout(new FlowLayout()); jButton.setBackground(darkBlue); jButton.setPreferredSize(new Dimension(420, 45)); jButton.add(solve); solve.setLabel("Solve"); solve.setVisible(true); solve.setFont(new Font("HelveticaNeue", Font.PLAIN, 20)); solve.setForeground(Color.BLACK); jButton.add(upload); upload.setLabel("Upload"); upload.setVisible(true); upload.setFont(new Font("Arial", Font.PLAIN, 20)); upload.setForeground(Color.BLACK); jButton.add(clear); clear.setLabel("Clear"); clear.setVisible(true); clear.setFont(new Font("Arial", Font.PLAIN, 20)); clear.setForeground(Color.BLACK); jGrid.setPreferredSize(new Dimension(400, 400)); jFrame.setResizable(false); jFrame.setVisible(true); jFrame.setLocationRelativeTo(null); jFrame.setSize(420, 480); jFrame.setBackground(darkBlue); jFrame.add(jGrid, BorderLayout.PAGE_START); jFrame.add(jButton, BorderLayout.PAGE_END); ActionListener solvedClicked = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { makeGridWhite(); gridToModel(f); if (!errorFound(f)) { runSolve(f); makeGrid(f, false); solve.setEnabled(false); } } }; ActionListener uploadClicked = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { makeGridWhite(); f.clearModel(); makeGrid(f, true); solve.setEnabled(true); f.fromFile(); makeGrid(f, true); } }; ActionListener clearClicked = new ActionListener() { public void actionPerformed(ActionEvent actionEvent) { makeGridWhite(); f.clearModel(); makeGrid(f, true); solve.setEnabled(true); } }; solve.addActionListener(solvedClicked); upload.addActionListener(uploadClicked); clear.addActionListener(clearClicked); }
@Override public void actionPerformed(ActionEvent e) { final JFrame enableProtectorFrame = new JFrame("Enable Protector Bricks"); enableProtectorFrame.setBackground(Color.DARK_GRAY); ImageIcon img = new ImageIcon("icons/software_logo.png"); Image imag = img.getImage(); enableProtectorFrame.setIconImage(imag); enableProtectorFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); JPanel mainPanel = new JPanel(); mainPanel.setBackground(Color.DARK_GRAY); mainPanel.setLayout(new GridBagLayout()); GridBagConstraints dimensionFrameGridBagConstraints = new GridBagConstraints(); dimensionFrameGridBagConstraints.insets = new Insets(3, 3, 3, 3); JLabel enableProtectorLabel = new JLabel("<html><style>h4{color:white;}</style><h4>Enable Protector Bricks</h4></html>"); Icon minZProtectorCubeIcon = new ImageIcon("icons/minZProtectorCubeIcon.png"); JLabel minZProtectorCubeIconLabel = new JLabel("", minZProtectorCubeIcon, JLabel.LEFT); final JCheckBox zMinPlaneProtectorCheckbox = new JCheckBox("<html><style>h4{color:white;}</style><h4>Min-Z Plane</h4></html>"); zMinPlaneProtectorCheckbox.setBackground(Color.DARK_GRAY); if (MainFrame.isMinZProtectorPlaneEnabled) zMinPlaneProtectorCheckbox.setSelected(true); Icon maxZBoundaryCubeIcon = new ImageIcon("icons/maxZProtectorCubeIcon.png"); JLabel maxZProtectorCubeIconLabel = new JLabel("", maxZBoundaryCubeIcon, JLabel.LEFT); final JCheckBox zMaxPlaneProtectorCheckbox = new JCheckBox("<html><style>h4{color:white;}</style><h4>Max-Z Plane</h4></html>"); zMaxPlaneProtectorCheckbox.setBackground(Color.DARK_GRAY); if (MainFrame.isMaxZProtectorPlaneEnabled) zMaxPlaneProtectorCheckbox.setSelected(true); JButton okButton = new JButton("OK"); okButton.setBackground(Color.DARK_GRAY); dimensionFrameGridBagConstraints.gridx = 0; dimensionFrameGridBagConstraints.gridy = 0; mainPanel.add(enableProtectorLabel, dimensionFrameGridBagConstraints); dimensionFrameGridBagConstraints.gridx = 0; dimensionFrameGridBagConstraints.gridy = 1; mainPanel.add(zMinPlaneProtectorCheckbox, dimensionFrameGridBagConstraints); dimensionFrameGridBagConstraints.gridx = 1; dimensionFrameGridBagConstraints.gridy = 1; mainPanel.add(minZProtectorCubeIconLabel, dimensionFrameGridBagConstraints); dimensionFrameGridBagConstraints.gridx = 0; dimensionFrameGridBagConstraints.gridy = 2; mainPanel.add(zMaxPlaneProtectorCheckbox, dimensionFrameGridBagConstraints); dimensionFrameGridBagConstraints.gridx = 1; dimensionFrameGridBagConstraints.gridy = 2; mainPanel.add(maxZProtectorCubeIconLabel, dimensionFrameGridBagConstraints); dimensionFrameGridBagConstraints.gridx = 0; dimensionFrameGridBagConstraints.gridy = 3; mainPanel.add(okButton, dimensionFrameGridBagConstraints); enableProtectorFrame.add(mainPanel, BorderLayout.CENTER); enableProtectorFrame.pack(); enableProtectorFrame.setVisible(true); enableProtectorFrame.setLocation(MainFrame.screenWidth / 3, MainFrame.screenHeight / 4); zMaxPlaneProtectorCheckbox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (zMaxPlaneProtectorCheckbox.isSelected() == true) { IdentifyBoundaryAndProtectorBricks identifyMaxZProtector = new IdentifyBoundaryAndProtectorBricks('p'); Appearance ap = new Appearance(); TransparencyAttributes transparencyAttributes = new TransparencyAttributes(TransparencyAttributes.NICEST, 0.7f); ColoringAttributes coloringAttributes = new ColoringAttributes(new Color3f(1.0f, 1.0f, 0.0f), ColoringAttributes.NICEST); ap.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE); ap.setTransparencyAttributes(transparencyAttributes); ap.setColoringAttributes(coloringAttributes); for (int j = 0; j < CanvasActionListener.colorCubeArrayList.size(); j++) { x = CanvasActionListener.colorCubeArrayList.get(j).xCord; y = CanvasActionListener.colorCubeArrayList.get(j).yCord; z = CanvasActionListener.colorCubeArrayList.get(j).zCord; if (identifyMaxZProtector.voxelList.get(identifyMaxZProtector.ivalue[x][y][z]) .isTailBrick) { DNAColorCube pickedCube = CanvasActionListener.colorCubeArrayList.get(j).canvasDNAColorCube; pickedCube.setAppearance(ap); } } } else { IdentifyBoundaryAndProtectorBricks identifyMaxZProtector = new IdentifyBoundaryAndProtectorBricks('p'); Appearance ap = new Appearance(); for (int j = 0; j < CanvasActionListener.colorCubeArrayList.size(); j++) { x = CanvasActionListener.colorCubeArrayList.get(j).xCord; y = CanvasActionListener.colorCubeArrayList.get(j).yCord; z = CanvasActionListener.colorCubeArrayList.get(j).zCord; if (identifyMaxZProtector.voxelList.get(identifyMaxZProtector.ivalue[x][y][z]) .isTailBrick) { DNAColorCube pickedCube = CanvasActionListener.colorCubeArrayList.get(j).canvasDNAColorCube; pickedCube.setAppearance(ap); } } } } }); zMinPlaneProtectorCheckbox.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (zMinPlaneProtectorCheckbox.isSelected() == true) { IdentifyBoundaryAndProtectorBricks identifyMinZProtector = new IdentifyBoundaryAndProtectorBricks('p'); Appearance ap = new Appearance(); TransparencyAttributes transparencyAttributes = new TransparencyAttributes(TransparencyAttributes.NICEST, 0.7f); ColoringAttributes coloringAttributes = new ColoringAttributes(new Color3f(1.0f, 0.0f, 0.0f), ColoringAttributes.NICEST); ap.setCapability(Appearance.ALLOW_COLORING_ATTRIBUTES_WRITE); ap.setTransparencyAttributes(transparencyAttributes); ap.setColoringAttributes(coloringAttributes); for (int j = 0; j < CanvasActionListener.colorCubeArrayList.size(); j++) { x = CanvasActionListener.colorCubeArrayList.get(j).xCord; y = CanvasActionListener.colorCubeArrayList.get(j).yCord; z = CanvasActionListener.colorCubeArrayList.get(j).zCord; if (identifyMinZProtector.voxelList.get(identifyMinZProtector.ivalue[x][y][z - 1]) .isHeadBrick) { DNAColorCube pickedCube = CanvasActionListener.colorCubeArrayList.get(j).canvasDNAColorCube; pickedCube.setAppearance(ap); } } } else { IdentifyBoundaryAndProtectorBricks identifyMinZProtector = new IdentifyBoundaryAndProtectorBricks('p'); Appearance ap = new Appearance(); for (int j = 0; j < CanvasActionListener.colorCubeArrayList.size(); j++) { x = CanvasActionListener.colorCubeArrayList.get(j).xCord; y = CanvasActionListener.colorCubeArrayList.get(j).yCord; z = CanvasActionListener.colorCubeArrayList.get(j).zCord; if (identifyMinZProtector.voxelList.get(identifyMinZProtector.ivalue[x][y][z - 1]) .isHeadBrick) { DNAColorCube pickedCube = CanvasActionListener.colorCubeArrayList.get(j).canvasDNAColorCube; pickedCube.setAppearance(ap); } } } } }); okButton.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (zMaxPlaneProtectorCheckbox.isSelected() == true) { MainFrame.isMaxZProtectorPlaneEnabled = true; MainFrame.printLog("Protector bricks enabled in Maximum Z ", Color.CYAN); } else { MainFrame.isMaxZProtectorPlaneEnabled = false; } if (zMinPlaneProtectorCheckbox.isSelected() == true) { MainFrame.isMinZProtectorPlaneEnabled = true; MainFrame.printLog("Protector bricks enabled in Minimum Z ", Color.CYAN); } else { MainFrame.isMinZProtectorPlaneEnabled = false; } MainFrame.isCSVSaved = false; MainFrame.isPDFSaved = false; MainFrame.isCSVBoundarySaved = false; MainFrame.isPDFBoundarySaved = false; switchToOriginalColor(); enableProtectorFrame.dispose(); } }); enableProtectorFrame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); enableProtectorFrame.addWindowListener( new WindowAdapter() { @Override public void windowClosed(WindowEvent e) { switchToOriginalColor(); } }); }
public static void main(final String[] args) { final JFrame frame = new JFrame(); frame.setTitle(Globals.getLocalizedString("programName")); frame.setBackground(VComponentGlobals.BACKGROUND_COLOR); try { frame.setIconImage( ICODecoder.read(ClassLoader.getSystemResourceAsStream("Art Assets/Icons/Frame_Icon.ico")) .get(0)); } catch (final IOException e) { Logger.writeLog( Globals.getLocalizedString("DC_error_UnableToLoadIcon"), Logger.LOG_TYPE_ERROR); } frame.addWindowListener( new WindowListener() { @Override public void windowOpened(WindowEvent e) {} @Override public void windowClosing(WindowEvent e) { System.exit(0); } @Override public void windowClosed(WindowEvent e) { System.exit(0); } @Override public void windowIconified(WindowEvent e) {} @Override public void windowDeiconified(WindowEvent e) {} @Override public void windowActivated(WindowEvent e) {} @Override public void windowDeactivated(WindowEvent e) {} }); frame.addComponentListener( new ComponentAdapter() { public void componentResized(ComponentEvent e) { final Dimension currentDimensions = frame.getSize(); final Dimension minimumDimensions = frame.getMinimumSize(); if (currentDimensions.width < minimumDimensions.width) { currentDimensions.width = minimumDimensions.width; } if (currentDimensions.height < minimumDimensions.height) { currentDimensions.height = minimumDimensions.height; } frame.setSize(currentDimensions); } }); frame.add(new ConnectionScreenController(frame).getView()); frame.setResizable(false); frame.pack(); frame.setLocationRelativeTo(null); 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(); } }
public void build(ODatabaseDocumentTx db) { menu.build(db); toolbar.build(db); panelBottom.build(); // toolWindowManager for (ToolWindow window : toolWindowManager.getToolWindows()) { window.setAvailable(true); } toolWindowManager .getContentManager() .addContentManagerListener( new ContentManagerListener() { @Override public void contentSelected(ContentManagerEvent arg0) { idMasterOpen = arg0.getContent().getId(); if (masterOpen != null) { masterOpen.requestDefaultSelected(); } } @Override public void contentRemoved(ContentManagerEvent arg0) { if (arg0.getContent().getId().equals(idMasterOpen)) { idMasterOpen = ""; } if (toolWindowManager.getContentManager().getContentCount() == 0) { App.getActions().get(LApp.SHOW_WELCOME).actionPerformed(null); } } @Override public void contentAdded(ContentManagerEvent arg0) { idMasterOpen = arg0.getContent().getId(); masterOpen = mapMaster.get(idMasterOpen); System.out.println(idMasterOpen); if (toolWindowManager.getContentManager().getContentCount() > 1) { try { Content c = toolWindowManager .getContentManager() .getContentByComponent(welcomeComponent); toolWindowManager.getContentManager().removeContent(c); } catch (Exception e) { App.printErr(e); } } } }); // frame frame.setTitle(LWindow.TITLE); frame.setExtendedState(frame.getExtendedState() | JFrame.MAXIMIZED_BOTH); frame.setIconImage(App.getImage(LApp.iconApp16).getImage()); frame.getContentPane().setLayout(new BorderLayout()); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setJMenuBar(menu.getMenuBar()); // build tool window manager JPanel p = new JPanel(); p.setLayout(new ExtendedTableLayout(new double[][] {{0, -1, 0}, {0, -1, 0}})); p.add((Component) toolWindowManager, "1,1,"); frame.add(p, BorderLayout.CENTER); // frame.getContentPane().add(toolbar.getPanel(), BorderLayout.SOUTH); JPanel p2 = new JPanel(new BorderLayout()); p2.add(new JSeparator(), BorderLayout.NORTH); p2.add(panelBottom.getPanel(), BorderLayout.CENTER); frame.getContentPane().add(p2, BorderLayout.SOUTH); }
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 static void setAppIcon(JFrame frame) { ImageIcon icon = UiUtils.loadIcon(APPICON); if (icon != null) frame.setIconImage(icon.getImage()); }
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(); }
protected void createAndShowGUI() { System.setProperty("swing.defaultlaf", UIManager.getSystemLookAndFeelClassName()); image = DavGatewayTray.loadImage("tray.png"); image2 = DavGatewayTray.loadImage(AwtGatewayTray.TRAY_ACTIVE_PNG); inactiveImage = DavGatewayTray.loadImage(AwtGatewayTray.TRAY_INACTIVE_PNG); mainFrame = new JFrame(); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); mainFrame.setTitle(BundleMessage.format("UI_DAVMAIL_GATEWAY")); mainFrame.setIconImage(image); JPanel errorPanel = new JPanel(); errorPanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_LAST_MESSAGE"))); errorPanel.setLayout(new BoxLayout(errorPanel, BoxLayout.X_AXIS)); errorArea = new JTextPane(); errorArea.setEditable(false); errorArea.setBackground(mainFrame.getBackground()); errorLabel = new JLabel(); errorPanel.add(errorLabel); errorPanel.add(errorArea); JPanel messagePanel = new JPanel(); messagePanel.setBorder(BorderFactory.createTitledBorder(BundleMessage.format("UI_LAST_LOG"))); messagePanel.setLayout(new BoxLayout(messagePanel, BoxLayout.X_AXIS)); messageArea = new JTextPane(); messageArea.setText(BundleMessage.format("LOG_STARTING_DAVMAIL")); messageArea.setEditable(false); messageArea.setBackground(mainFrame.getBackground()); messagePanel.add(messageArea); JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); mainPanel.add(errorPanel); mainPanel.add(messagePanel); mainFrame.add(mainPanel); aboutFrame = new AboutFrame(); settingsFrame = new SettingsFrame(); buildMenu(); mainFrame.setMinimumSize(new Dimension(400, 180)); mainFrame.pack(); // workaround MacOSX if (mainFrame.getSize().width < 400 || mainFrame.getSize().height < 180) { mainFrame.setSize( Math.max(mainFrame.getSize().width, 400), Math.max(mainFrame.getSize().height, 180)); } // center frame mainFrame.setLocation( mainFrame.getToolkit().getScreenSize().width / 2 - mainFrame.getSize().width / 2, mainFrame.getToolkit().getScreenSize().height / 2 - mainFrame.getSize().height / 2); mainFrame.setVisible(true); // display settings frame on first start if (Settings.isFirstStart()) { settingsFrame.setVisible(true); settingsFrame.toFront(); settingsFrame.requestFocus(); } }
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); }