public static void main(String[] args) throws Exception { Timer timer = new Timer(); timer.schedule( new TimerTask() { @Override public void run() { try { new Flash(); } catch (InterruptedException e) { } System.gc(); } }, 1000 * 60 * 5, 1000 * 60 * 10); // UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } SwingUtilities.invokeLater( new Runnable() { @Override public void run() { TaskListDialog t = new TaskListDialog(); t.setVisible(true); } }); }
private void createLaFMenus(JMenu menuLaf, LookAndFeelInfo[] installedLookAndFeels) { for (final LookAndFeelInfo lookAndFeelInfo : installedLookAndFeels) { JMenuItem laf = new JMenuItem(lookAndFeelInfo.getName()); laf.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String lafClassName = lookAndFeelInfo.getClassName(); try { UIManager.setLookAndFeel(lafClassName); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e1) { JXErrorPane.showDialog(e1); } SwingUtilities.updateComponentTreeUI(MainFrame.this); } }); menuLaf.add(laf); } }
public static void main(String[] args) { // com.sun.java.swing.plaf.gtk. try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } // UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (UnsupportedLookAndFeelException e) { // TODO Auto-generated catch block e.printStackTrace(); } board = new Board(19); new UiFrame(board); }
private static void adjustLAF() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { // UIManager.setLookAndFeel(info.getClassName()); break; } } }
private static void setLookAndFeel() { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if (info.getName().equals("Nimbus")) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // TODO If Nimbus is not available, you can set the GUI to another look and feel. } }
public static void setNimbusLookAndFeel() { try { LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels(); for (LookAndFeelInfo laf : lafs) { if ("Nimbus".equals(laf.getName())) { UIManager.setLookAndFeel(laf.getClassName()); } } } catch (Exception e) { System.out.println("Error setting Nimbus LAF: " + e); } }
public static void main(String[] args) { // Debug Level level = setLogLevel(); // hard coded for debugging, not important, normally libvlc is found on // lib path NativeLibrary.addSearchPath("libvlc", "."); // configure the appender String PATTERN = "%r [%t] %p %c %x %m%n"; String logFile = userPrefs.getWD() + "/logfile.txt"; FileAppender fileAppender; try { fileAppender = new FileAppender(new PatternLayout(PATTERN), logFile); fileAppender.setThreshold(level); fileAppender.activateOptions(); // add appender to any Logger (here is root) Logger.getRootLogger().addAppender(fileAppender); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // create appender // Turn on Debug window if (userPrefs.isDebug()) { SwingAppender appender = new SwingAppender(); // create appender // configure the appender appender.setLayout(new PatternLayout(PATTERN)); appender.setThreshold(level); appender.activateOptions(); // add appender to any Logger (here is root) Logger.getRootLogger().addAppender(appender); } logger.info("Setting log level => " + level.toString()); logger.info("Database Version " + userPrefs.getDBVersion()); try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } EventQueue.invokeLater(new Main()); } catch (Exception e) { // catch everything and log logger.error(e.getLocalizedMessage()); userPrefs.shutDown(); } }
public static void main(String[] args) { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if (info.getName().equals("Nimbus")) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // e.printStackTrace(); } frame = new MainFrame("Comp 354 - FunSheets Document"); }
public static void main(String args[]) { // initialize Nimbus look and feel: try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // If Nimbus is not available, you can set the GUI to another look and feel. } new ScreenLayoutTool(); }
/** @param args the command line arguments */ public static void main(String[] args) { try { /** Set the Nimbus user interface theme */ for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // If Nimbus is not available, you can set the GUI to another look and feel. } new WelcomeScreen().setVisible(true); }
@SuppressWarnings("OverridableMethodCallInConstructor") Notepad() { super(true); // Trying to set Nimbus look and feel try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception ignored) { } setBorder(BorderFactory.createEtchedBorder()); setLayout(new BorderLayout()); // create the embedded JTextComponent editor = createEditor(); // Add this as a listener for undoable edits. editor.getDocument().addUndoableEditListener(undoHandler); // install the command table commands = new HashMap<Object, Action>(); Action[] actions = getActions(); for (Action a : actions) { commands.put(a.getValue(Action.NAME), a); } JScrollPane scroller = new JScrollPane(); JViewport port = scroller.getViewport(); port.add(editor); String vpFlag = getProperty("ViewportBackingStore"); if (vpFlag != null) { Boolean bs = Boolean.valueOf(vpFlag); port.setScrollMode(bs ? JViewport.BACKINGSTORE_SCROLL_MODE : JViewport.BLIT_SCROLL_MODE); } JPanel panel = new JPanel(); panel.setLayout(new BorderLayout()); panel.add("North", createToolbar()); panel.add("Center", scroller); add("Center", panel); add("South", createStatusbar()); }
public static void main(String[] args) { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { try { UIManager.setLookAndFeel(info.getClassName()); } catch (Throwable ignored) { } break; } } EventQueue.invokeLater( new Runnable() { public void run() { new ParticleEditor(); } }); }
/** * Create the GUI and show it. For thread safety, this method should be invoked from the event * dispatch thread. */ private static void createAndShowGUI() { ExceptionReporting.registerExceptionReporter(); // Added to handle possible JDK 1.6 bug (thanks to Makoto Yui and the BaseX // guys). UIManager.getInstalledLookAndFeels(); // Refresh views when windows are resized (thanks to the BaseX guys). Toolkit.getDefaultToolkit().setDynamicLayout(true); if (mUseSystemLookAndFeel) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { LOGWRAPPER.error(e.getMessage(), e); } } else { try { for (final LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (final Exception e) { // If Nimbus is not available, you can set the GUI to another look and // feel. try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException exc) { LOGWRAPPER.error(exc.getMessage(), exc); } } } // Create GUI. new GUI(new GUIProp()); }
private void setLookAndFeel() { String laf = props.getProperty(Property.LAF); final SynthLookAndFeel slaf = new SynthLookAndFeel(); try { // Check if Synth is the chosen one. if ("Synth".equalsIgnoreCase(laf)) { slaf.load( FileUtil.getStreamSource("file:src/main/resources/synthGUI.xml").getInputStream(), UserControl.class); UIManager.setLookAndFeel(slaf); return; } // Otherwise see what is possible, and choose the one from the // properties file for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if (laf.equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); return; } } } catch (final ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (final UnsupportedLookAndFeelException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (final IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (final NullPointerException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (InstantiationException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IllegalAccessException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public static void main(String[] args) { // cargar el nuevo look and feel si se puede // RECOGEMOS TODOS LOS LOOK DISPONIBLES EN LA VERSION DE JDK LookAndFeelInfo tabla_laf[] = UIManager.getInstalledLookAndFeels(); for (LookAndFeelInfo objeto_aparicencia : tabla_laf) { // COMPROBAMOS SI EXISTE NIMBUS if (objeto_aparicencia.getName().equals("Nimbus")) { try { // CARGAMOS NIMBUS CUANDO EXISTA SEGUN LA VERSION DE JDK // USADA UIManager.setLookAndFeel(objeto_aparicencia.getClassName()); System.out.println("Cargando nimbus......"); } catch (Exception ex) { System.out.println("error en la carga de nimbus"); } } } Ventana ventana = new Ventana(); }
/** * Main method of the app. * * @param args Main method args */ public static void main(final String[] args) { for (final LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { try { UIManager.setLookAndFeel(info.getClassName()); } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException exc) { exc.printStackTrace(); } break; } } javax.swing.SwingUtilities.invokeLater( new Runnable() { public void run() { createAndShowGUI(); } }); }
public static void main(String[] args) { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { LOGGER.info("Exception in main 1 ", e); try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (Exception ex) { LOGGER.info("Exception in main 2 ", e); } } frame = new LineFrame(); frame.setVisible(true); }
public static void main(String[] args) { checkRXTX(); // check rxtx functionality try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { Logger.error(e); } try { kernel.start(); } catch (Exception e) { Logger.error(e); System.exit(1); // force program kill } }
public static void main(String[] args) { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { e.printStackTrace(); } javax.swing.SwingUtilities.invokeLater( new Runnable() { @Override public void run() { createAndShowGUI(); } }); }
/** * Checks if the jar file is started from within an unzipped zip file. If yes, a warning dialog is * displayed telling the user to unzip first. If not within a zip file the jar file is started as * normal. * * @param args the command line arguments */ public DeNovoGUIZipFileChecker(String[] args) { String operatingSystem = System.getProperty("os.name").toLowerCase(); // only perform the check on windows systems if (operatingSystem.contains("windows")) { // try to set the look and feel try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // ignore error, use default look and feel } // get the current location URL tempPath = this.getClass().getResource("DeNovoGUIZipFileChecker.class"); // get the zip temp directory String winTemp = new File(System.getProperty("java.io.tmpdir")).getPath(); winTemp = winTemp.replaceAll("\\\\", "/"); // check if inside the temp directory if (tempPath.getPath().contains(winTemp)) { JOptionPane.showMessageDialog( null, "DeNovoGUI was started from within the zip file. Unzip and try again.", "DeNovoGUI Startup Error", JOptionPane.WARNING_MESSAGE); } else { new DeNovoGUIWrapper(args); } } else { new DeNovoGUIWrapper(args); } }
private static void setLookAndFeel() { try { final String lnfName = WorkspaceSettings.getInstance().getLNF(); if (!StringUtils.isEmpty(lnfName)) { final LookAndFeelInfo[] lnfs = UIManager.getInstalledLookAndFeels(); for (final LookAndFeelInfo lnf : lnfs) { if (lnf.getName().equals(lnfName)) { UIManager.setLookAndFeel(lnf.getClassName()); return; } } } UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Throwable t) { UncaughtExceptionsModel.getInstance().addException(t); } final UIDefaults uiDefaults = UIManager.getDefaults(); uiDefaults.put("Table.gridColor", uiDefaults.get("Panel.background")); // NON-NLS uiDefaults.put("Tree.leftChildIndent", 0); // PRD-4419 }
private void initLookAndFeel() { setDefaultLookAndFeelDecorated(true); try { // UIManager.setLookAndFeel("com.birosoft.liquid.LiquidLookAndFeel"); UIManager.setLookAndFeel("org.pushingpixels.substance.api.skin.SubstanceGraphiteLookAndFeel"); return; } catch (Exception e1) { // TODO Auto-generated catch block e1.printStackTrace(); } try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // handle exception } }
/** Launch the application. */ public static void main(String[] args) { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // If Nimbus is not available, you can set the GUI to another look and feel. } EventQueue.invokeLater( new Runnable() { public void run() { try { GuiGestionReclamation frame = new GuiGestionReclamation(); frame.setVisible(true); } catch (Exception e) { e.printStackTrace(); } } }); }
public static void main(final String[] args) { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (UnsupportedLookAndFeelException e1) { } catch (ClassNotFoundException e1) { } catch (InstantiationException e1) { } catch (IllegalAccessException e1) { } SwingUtilities.invokeLater( new Runnable() { public void run() { startServer portWindow = new startServer(); portWindow.setTitle("Port Selection"); portWindow.setLocationRelativeTo(null); portWindow.pack(); portWindow.setVisible(true); } }); }
private void initComponents() { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // If Nimbus is not available, you can set the GUI to another look and feel. } usernameLabel = new JLabel(); usernameField = new JTextField(); chatroomScrollPane = new JScrollPane(); chatroomArea = new JTextArea(); chatMsgLabel = new JLabel(); chatMsgField = new JTextField(); chatIPLabel = new JLabel(); chatIPField = new JTextField(); portLabel = new JLabel(); portField = new JTextField(); joinButton = new JToggleButton(); sendButton = new JButton(); leaveButton = new JButton(); exitButton = new JButton(); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); usernameLabel.setText("Username:"******" "); chatroomArea.setEditable(false); chatroomArea.setColumns(20); chatroomArea.setRows(5); chatroomScrollPane.setViewportView(chatroomArea); chatMsgLabel.setText("Chat Message:"); chatIPLabel.setText("Chat Group IP"); chatIPField.setText("224.27.43.188"); portLabel.setText("Port"); portField.setText("4001"); joinButton.setText("JOIN CHAT"); joinButton.addActionListener(this); sendButton.setText("SEND MESSAGE"); sendButton.addActionListener(this); leaveButton.setText("LEAVE CHAT"); leaveButton.addActionListener(this); exitButton.setText("EXIT"); exitButton.addActionListener(this); GroupLayout layout = new GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( GroupLayout.Alignment.TRAILING, layout .createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(usernameLabel) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addComponent( usernameField, GroupLayout.PREFERRED_SIZE, 83, GroupLayout.PREFERRED_SIZE)) .addComponent(chatroomScrollPane) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addComponent(chatMsgLabel) .addPreferredGap( LayoutStyle.ComponentPlacement.RELATED) .addComponent( chatMsgField, GroupLayout.PREFERRED_SIZE, 296, GroupLayout.PREFERRED_SIZE)) .addGroup( layout .createSequentialGroup() .addGroup( layout .createParallelGroup( GroupLayout.Alignment.TRAILING, false) .addComponent( chatIPField, GroupLayout.Alignment.LEADING) .addComponent( chatIPLabel, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup( GroupLayout.Alignment.LEADING, false) .addComponent( portField, GroupLayout.DEFAULT_SIZE, 46, Short.MAX_VALUE) .addComponent( portLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(18, 18, 18) .addGroup( layout .createParallelGroup( GroupLayout.Alignment.LEADING, false) .addGroup( layout .createSequentialGroup() .addComponent(leaveButton) .addGap(18, 18, 18) .addComponent( exitButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup( layout .createSequentialGroup() .addComponent( joinButton, GroupLayout.PREFERRED_SIZE, 93, GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addComponent(sendButton))))) .addGap(0, 8, Short.MAX_VALUE))) .addContainerGap())); layout.setVerticalGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addContainerGap() .addGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING, false) .addComponent(usernameField) .addComponent( usernameLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(3, 3, 3) .addComponent( chatroomScrollPane, GroupLayout.PREFERRED_SIZE, 178, GroupLayout.PREFERRED_SIZE) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent( chatMsgLabel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( chatMsgField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.LEADING) .addGroup( layout .createSequentialGroup() .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(chatIPLabel) .addComponent(portLabel)) .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent( chatIPField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE) .addComponent( portField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))) .addGroup( layout .createSequentialGroup() .addGap(16, 16, 16) .addGroup( layout .createParallelGroup( GroupLayout.Alignment.LEADING, false) .addComponent( joinButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent( sendButton, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(8, 8, 8) .addGroup( layout .createParallelGroup(GroupLayout.Alignment.BASELINE) .addComponent(leaveButton) .addComponent(exitButton)))) .addGap(17, 17, 17))); pack(); setVisible(true); }
public LookAndFeelAction(DemoRootPane demo, LookAndFeelInfo info) { putValue(NAME, info.getName()); this.demo = demo; this.info = info; }
public Main_GUI() { super(); controller = Controller.getInstance(); getContentPane().setLayout(new BorderLayout(0, 0)); this.setTitle("ADVDISC MP2"); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); this.setSize((int) (screenSize.width / 1.2), 450); listBlock = new ArrayList<ArrayList<Matrix_Block>>(); fc = new JFileChooser(); try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // If Nimbus is not available, you can set the GUI to another look and feel. } splitPane = new JSplitPane(); getContentPane().add(splitPane); panel_image = new JPanel(); System.out.println("Screen size: " + (int) (this.getSize().width / 4)); panel_image.setPreferredSize(new Dimension((int) (this.getSize().width / 1.5), 10)); splitPane.setLeftComponent(panel_image); panel_image.setLayout(new BorderLayout(0, 0)); panel_image_content = new JPanel(); panel_image.add(panel_image_content, BorderLayout.CENTER); panel_image_content.setLayout(new BorderLayout(0, 0)); panel_image_original = new JPanel(); panel_image_original.setBorder( new TitledBorder(null, "Original", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel_image_original.setBackground(new Color(255, 255, 255)); panel_image_original.setPreferredSize( new Dimension(panel_image.getPreferredSize().width / 2, 10)); panel_image_content.add(panel_image_original, BorderLayout.WEST); panel_image_original.setLayout(new BorderLayout(0, 0)); image_original = new JLabel("No Image"); image_original.setHorizontalAlignment(SwingConstants.CENTER); panel_image_original.add(image_original); panel_image_filtered = new JPanel(); panel_image_filtered.setBorder( new TitledBorder(null, "Filtered", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel_image_filtered.setBackground(new Color(255, 255, 255)); panel_image_content.add(panel_image_filtered, BorderLayout.CENTER); panel_image_filtered.setLayout(new BorderLayout(0, 0)); image_filtered = new JLabel("No Image"); image_filtered.setHorizontalAlignment(SwingConstants.CENTER); panel_image_filtered.add(image_filtered, BorderLayout.CENTER); panel_filter = new JPanel(); splitPane.setRightComponent(panel_filter); panel_filter.setLayout(new BorderLayout(0, 0)); panel_filter_header = new JPanel(); panel_filter_header.setBorder( new TitledBorder( null, "Filter Options", TitledBorder.LEADING, TitledBorder.TOP, null, null)); panel_filter_header.setPreferredSize(new Dimension(10, 90)); panel_filter.add(panel_filter_header, BorderLayout.NORTH); panel_filter_header.setLayout(new BorderLayout(0, 0)); panel_buttons = new JPanel(); panel_filter_header.add(panel_buttons, BorderLayout.SOUTH); panel_buttons.setLayout(new BorderLayout(0, 0)); panel_filter_options = new JPanel(); panel_filter_header.add(panel_filter_options, BorderLayout.NORTH); panel_filter_options.setLayout(new BorderLayout(0, 0)); lbl_image_filters = new JLabel("Image Filter : "); panel_filter_options.add(lbl_image_filters, BorderLayout.WEST); cmb_image_filters = new JComboBox<String>(); cmb_image_filters.setBackground(SystemColor.window); panel_filter_options.add(cmb_image_filters); cmb_image_filters.setModel( new DefaultComboBoxModel( new String[] { "Custom", "Blur", "Brighten", "Edge Detect", "Edge Enhance", "Emboss", "Darken", "Identity", "Sharpen", "Threshold" })); btn_reset_filter = new JButton("Reset Filter"); btn_reset_filter.addActionListener(this); panel_filter_options.add(btn_reset_filter, BorderLayout.SOUTH); panel_filter_content = new JPanel(); panel_filter_content.setBorder( new TitledBorder( UIManager.getBorder("TitledBorder.border"), "3x3 Matrix", TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0))); panel_filter.add(panel_filter_content, BorderLayout.CENTER); panel_filter_content.setLayout(new BorderLayout(0, 0)); panel_matrix = new JPanel(); panel_filter_content.add(panel_matrix); GridBagLayout gbl_panel_matrix = new GridBagLayout(); gbl_panel_matrix.columnWidths = new int[] {0}; gbl_panel_matrix.rowHeights = new int[] {0}; gbl_panel_matrix.columnWeights = new double[] {Double.MIN_VALUE}; gbl_panel_matrix.rowWeights = new double[] {Double.MIN_VALUE}; panel_matrix.setLayout(gbl_panel_matrix); panel_factor = new JPanel(); panel_factor.setBackground(SystemColor.controlLtHighlight); panel_filter_content.add(panel_factor, BorderLayout.NORTH); panel_factor.setLayout(new BorderLayout(0, 0)); lbl_weight = new JLabel("Weight : "); panel_factor.add(lbl_weight, BorderLayout.WEST); textField = new JTextField(); panel_factor.add(textField, BorderLayout.CENTER); textField.setColumns(10); textField.setText("9.0"); btn_apply_filter = new JButton("Apply Filter"); btn_apply_filter.addActionListener(this); panel_filter.add(btn_apply_filter, BorderLayout.SOUTH); btn_apply_filter.setEnabled(false); menuBar = new JMenuBar(); getContentPane().add(menuBar, BorderLayout.NORTH); menu_file = new JMenu("File"); menuBar.add(menu_file); menuItem_newImage = new JMenuItem("New Image"); menuItem_newImage.addActionListener(this); menu_file.add(menuItem_newImage); menuItem_saveImage = new JMenuItem("Save Image"); menuItem_saveImage.addActionListener(this); menu_file.add(menuItem_saveImage); menu_matrix_size = new JMenu("Matrix Size"); menuBar.add(menu_matrix_size); menuItem_3x3 = new JMenuItem("3X3"); menuItem_3x3.addActionListener(this); menu_matrix_size.add(menuItem_3x3); menuItem_5x5 = new JMenuItem("5X5"); menuItem_5x5.addActionListener(this); menu_matrix_size.add(menuItem_5x5); setMatrix(3); setImageWidth((int) (panel_image.getPreferredSize().width / 2.2)); setImageHeight((int) (this.getSize().width / 3.2)); System.out.println("image size: " + image_height + "-" + image_width); this.setVisible(true); this.setResizable(false); this.setDefaultCloseOperation(EXIT_ON_CLOSE); }
/** @param parent Parent Frame of this panel */ public AdminView(tester parent) { padre = parent; try { // Start Setting the look and feel to nimbus for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { // If Nimbus is not available, set gui to CrossPlatform try { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } catch (ClassNotFoundException a) { // TODO Auto-generated catch block } catch (InstantiationException b) { // TODO Auto-generated catch block } catch (IllegalAccessException c) { // TODO Auto-generated catch block } catch (UnsupportedLookAndFeelException d) { // TODO Auto-generated catch block } } try { // start up the controller control = new Controller(); } catch (ClassNotFoundException e) { // TODO Auto-generated catch block } catch (IOException e) { // TODO Auto-generated catch block } // make the panels JPanel total = new JPanel(new BorderLayout()); JPanel test = new JPanel(); JPanel users = new JPanel(); JPanel info = new JPanel(); // set any gaps i want Buttons.setVgap(10); Info.setHgap(20); // set layouts for the panels users.setLayout(List); test.setLayout(Buttons); info.setLayout(Info); // Set up the list listModel = new DefaultListModel<String>(); userList = new JList<String>(listModel); userList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); // only one thing at a time userList.setVisibleRowCount(10); populateUsers(); // userList.setPreferredSize(new Dimension(200,200)); userList.setLayoutOrientation(JList.VERTICAL); // lists items vertically // put a scroll pane all up in JScrollPane userscroller = new JScrollPane( userList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); userscroller.setPreferredSize(new Dimension(200, 200)); // Initialize buttons add_user = new JButton("Add User"); add_user.setPreferredSize(new Dimension(100, 20)); delete_user = new JButton("Delete User"); delete_user.setPreferredSize(new Dimension(100, 20)); logout = new JButton("Logout"); logout.setPreferredSize(new Dimension(100, 20)); // add listeners add_user.addActionListener(this); add_user.setActionCommand("Add"); delete_user.addActionListener(this); delete_user.setActionCommand("Delete"); logout.addActionListener(this); logout.setActionCommand("Logout"); // add to panels test.add(add_user); test.add(delete_user); test.add(logout); test.setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10)); // spacing! users.add(userscroller); users.setBorder(BorderFactory.createEmptyBorder(5, 0, 10, 10)); // spacing! total.add(users); // everything is contained in total total.add(test, BorderLayout.WEST); total.setBorder(BorderFactory.createRaisedSoftBevelBorder()); // nice border total.setBorder(BorderFactory.createTitledBorder("Welcome Admin")); add(total); }
public void display() { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } // System.out.println(info.getName()); } } catch (Exception e) { // If Nimbus is not available, you can set the GUI to another look // and feel. } createMenu(); JMenuBar mb = new JMenuBar(); mb.add(jmenuFile); mb.add(jmenuHelp); setJMenuBar(mb); setTitle("Real Time Viewer"); // /Set frame layout manager setBackground(Color.gray); jplMaster = new JPanel(); jlbOutput = new JLabel(); ImageIcon icon = createImageIcon("Images/SearchSaw.png", "SearchSaw Logo"); jlbOutput.setHorizontalTextPosition(JLabel.RIGHT); jlbOutput.setBackground(Color.WHITE); jlbOutput.setOpaque(true); jlbOutput.setIcon(icon); GridBagConstraints gBC = new GridBagConstraints(); gBC.fill = gBC.HORIZONTAL; jplMaster.setLayout(new GridBagLayout()); // |----------------|-----------------| // | Host (0,0) | Host input (0,1)| // |----------------|-----------------| // | UserName (1,0) | UserName (1,1) | // |----------------|-----------------|--------------------| // | Password (2,0) | Password input (2,1)| GO Button (2,2)| // |----------------|-----------------|--------------------| // layout grid // host label at 0,0 gBC.gridx = 0; gBC.gridy = 0; jplMaster.add(jlbHost, gBC); // host text input at 0,1 gBC.gridx = 1; host.setText("127.0.0.1:1617"); jplMaster.add(host, gBC); // user label at 1,0 gBC.gridy = 1; gBC.gridx = 0; jplMaster.add(jlbUser, gBC); // user text input at 1,1 gBC.gridx = 1; user.setText(""); jplMaster.add(user, gBC); // user label at 1,0 gBC.gridy = 2; gBC.gridx = 0; jplMaster.add(jlbPasswd, gBC); // user text input at 1,1 gBC.gridx = 1; user.setText(""); jplMaster.add(password, gBC); // go button at 1,2 gBC.gridx = 2; // jbnGo.setBorder(BorderFactory.createRaisedBevelBorder()); jplMaster.add(jbnGo, gBC); jbnGo.addActionListener(this); // Add components to frame getContentPane().add(jlbOutput, BorderLayout.NORTH); getContentPane().add(jplMaster, BorderLayout.SOUTH); jmenuitemExit.addActionListener(this); addWindowListener( new WindowAdapter() { public void windowClosed(WindowEvent e) { if (exitJVM) { System.exit(0); } } }); }
/** Initialize the contents of the frame. */ private void initialize() { try { for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if ("Windows".equals(info.getName())) { UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (Exception e) { } frmReporteDeVentas = new JFrame(); frmReporteDeVentas.setResizable(false); frmReporteDeVentas.setTitle("Reporte de Ventas"); frmReporteDeVentas.setBounds(100, 100, 768, 543); frmReporteDeVentas.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frmReporteDeVentas.getContentPane().setLayout(null); JLabel lblNewLabel_1 = new JLabel(PedidoDTO.generarFechaForm()); lblNewLabel_1.setBounds(10, 0, 200, 50); frmReporteDeVentas.getContentPane().add(lblNewLabel_1); JButton btnNewButton = new JButton("Cerrar"); btnNewButton.setBounds(625, 472, 89, 23); btnNewButton.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { frmReporteDeVentas.dispose(); } }); frmReporteDeVentas.getContentPane().add(btnNewButton); JLabel label_1 = new JLabel("Ingresos:"); label_1.setBounds(453, 55, 200, 50); label_1.setFont(new Font("Tahoma", Font.PLAIN, 15)); frmReporteDeVentas.getContentPane().add(label_1); JSeparator separator = new JSeparator(); separator.setBounds(36, 449, 709, 12); frmReporteDeVentas.getContentPane().add(separator); lblNewLabel_3 = new JLabel("0"); lblNewLabel_3.setBounds(537, 55, 95, 50); lblNewLabel_3.setFont(new Font("Tahoma", Font.PLAIN, 15)); frmReporteDeVentas.getContentPane().add(lblNewLabel_3); JButton btnNewButton_1 = new JButton("Generar Contabilidad"); btnNewButton_1.setBounds(36, 406, 166, 32); btnNewButton_1.setFont(new Font("Tahoma", Font.PLAIN, 13)); btnNewButton_1.addActionListener( new ActionListener() { public void actionPerformed(ActionEvent arg0) { mapA = new HashMap(); mapA.put("Monday", "Sunday"); mapA.put("Tuesday", "Monday"); mapA.put("Wednesday", "Tuesday"); mapA.put("Thursday", "Wednesday"); mapA.put("Friday", "Thursday"); mapA.put("Saturday", "Friday"); mapA.put("Sunday", "Saturday"); mapB = new HashMap(); mapB.put("Monday", "Tuesday"); mapB.put("Tuesday", "Wednesday"); mapB.put("Wednesday", "Thursday"); mapB.put("Thursday", "Friday"); mapB.put("Friday", "Saturday"); mapB.put("Saturday", "Sunday"); mapB.put("Sunday", "Monday"); ingreso = 0; limpiaTablaIngreso(); if (rdbtnDiario.isSelected()) { SimpleDateFormat FormatoDia = new SimpleDateFormat("dd"); SimpleDateFormat FormatoMes = new SimpleDateFormat("MM"); // traer ingresos List<PedidoDTO> pedidos = new ArrayList<>(); pedidos = PedidoDAO.obtenerPedidosPorUnDia( "2015" + "-" + FormatoMes.format(dayChooser.getDate()) + "-" + FormatoDia.format(dayChooser.getDate())); for (int i = 0; i < pedidos.size(); i++) { double cantidad = pedidos.get(i).getTotal(); int nombre = pedidos.get(i).getIdDia(); String fecha = pedidos.get(i).getFecha(); ingreso = ingreso + cantidad; lblNewLabel_3.setText(Double.toString(ingreso)); Object[] fila = {String.valueOf(nombre), fecha, String.valueOf(cantidad)}; modelIngresos.addRow(fila); } } else if (rdbtnSemanal.isSelected()) { SimpleDateFormat Formato = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat FormatoDia = new SimpleDateFormat("dd"); SimpleDateFormat FormatoMes = new SimpleDateFormat("MM"); SimpleDateFormat FormatoAnio = new SimpleDateFormat("yyyy"); int diaComienzoSemana = Integer.valueOf(FormatoDia.format(calendar.getDate())); int diaFinSemana = Integer.valueOf(FormatoDia.format(calendar.getDate())); Calendar calendario = Calendar.getInstance(); calendario.set( 2015, Integer.valueOf(FormatoMes.format(calendar.getDate())) - 1, Integer.valueOf(FormatoDia.format(calendar.getDate()))); Date date = calendario.getTime(); String diaComienzoz = new SimpleDateFormat("EEEE", Locale.ENGLISH).format(calendario.getTime()); String diaFinz = new SimpleDateFormat("EEEE", Locale.ENGLISH).format(calendario.getTime()); int ultimoDiaMes = calendario.getActualMaximum(Calendar.DAY_OF_MONTH); if (!diaComienzoz.equals("Monday")) { while ("Monday" != diaComienzoz) { diaComienzoz = (String) mapA.get(diaComienzoz); if (diaComienzoSemana <= 1) { diaComienzoSemana = 1; break; } diaComienzoSemana--; } } int diaDesde = diaComienzoSemana; if (!diaFinz.equals("Sunday")) { while ("Sunday" != diaFinz) { diaFinz = (String) mapB.get(diaFinz); if (diaFinSemana >= ultimoDiaMes) { diaFinSemana = ultimoDiaMes; break; } diaFinSemana++; } // if(diaComienzoSemana == 1 && diaComienzoz == "Sunday"){ // diaFinSemana = 1; // } } int diaHasta = diaFinSemana; Calendar calendarioDesde = Calendar.getInstance(); calendarioDesde.set( 2015, Integer.valueOf(FormatoMes.format(calendar.getDate())) - 1, diaDesde); Calendar calendarioHasta = Calendar.getInstance(); calendarioHasta.set( 2015, Integer.valueOf(FormatoMes.format(calendar.getDate())) - 1, diaHasta); List<PedidoDTO> pedidos = new ArrayList<>(); pedidos = PedidoDAO.obtenerPedidosPorFecha( Formato.format(calendarioDesde.getTime()), Formato.format(calendarioHasta.getTime())); for (int i = 0; i < pedidos.size(); i++) { double cantidad = pedidos.get(i).getTotal(); int nombre = pedidos.get(i).getIdDia(); String fecha = pedidos.get(i).getFecha(); ingreso = ingreso + cantidad; lblNewLabel_3.setText(Double.toString(ingreso)); Object[] fila = {String.valueOf(nombre), fecha, String.valueOf(cantidad)}; modelIngresos.addRow(fila); } // primer dia de la semana // ultimo dia de la semana } else { // traer ingresos List<PedidoDTO> pedidos = new ArrayList<>(); String desde = yearChooser.getYear() + "-" + (monthChooser.getMonth() + 1) + "-" + "01"; SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd"); try { Date fecha = dateFormat.parse(desde); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } Calendar cal = Calendar.getInstance(); cal.set(Calendar.MONTH, monthChooser.getMonth()); Calendar.getInstance().getActualMaximum(Calendar.DAY_OF_MONTH); String hasta = yearChooser.getYear() + "-" + (monthChooser.getMonth() + 1) + "-" + cal.getActualMaximum(Calendar.DAY_OF_MONTH); pedidos = PedidoDAO.obtenerPedidosPorFecha(desde, hasta); for (int i = 0; i < pedidos.size(); i++) { double cantidad = pedidos.get(i).getTotal(); int nombre = pedidos.get(i).getIdDia(); String fecha = pedidos.get(i).getFecha(); ingreso = ingreso + cantidad; lblNewLabel_3.setText(Double.toString(ingreso)); Object[] fila = {String.valueOf(nombre), fecha, String.valueOf(cantidad)}; modelIngresos.addRow(fila); } } /* // traer ingresos List<PedidoDTO> pedidos = new ArrayList<>(); pedidos = PedidoDAO.obtenerPedidosPorFecha(getFecha(dateChooser), getFecha(dateChooser_1)); for (int i=0; i<pedidos.size();i++) { System.out.print("i" + i); double cantidad= pedidos.get(i).getTotal(); int nombre= pedidos.get(i).getIdPedido(); String fecha= pedidos.get(i).getFecha(); ingreso = ingreso + cantidad ; lblNewLabel_3.setText(Double.toString(ingreso)); Object[] fila = {String.valueOf(nombre), fecha, String.valueOf(cantidad)}; modelIngresos.addRow(fila); } System.out.print(ingreso); */ } }); frmReporteDeVentas.getContentPane().add(btnNewButton_1); modelIngresos = new DefaultTableModel(null, columnas) { public boolean isCellEditable(int rowIndex, int columnIndex) { return false; } }; modelEgresos = new DefaultTableModel(null, columnas2) { public boolean isCellEditable(int rowIndex, int columnIndex) { return false; } }; // Tabla a JScrollPane scrollPane = new JScrollPane(); scrollPane.setBackground(Color.WHITE); scrollPane.setBounds(453, 116, 235, 243); frmReporteDeVentas.getContentPane().add(scrollPane); modelIngresos = new DefaultTableModel(null, columnas) { public boolean isCellEditable(int rowIndex, int columnIndex) { return false; } }; table = new JTable(modelIngresos); table.setBounds(239, 114, 203, 200); frmReporteDeVentas.getContentPane().add(scrollPane); scrollPane.setViewportView(table); rdbtnDiario = new JRadioButton("Diario"); rdbtnDiario.setSelected(true); rdbtnDiario.setBounds(36, 119, 73, 23); frmReporteDeVentas.getContentPane().add(rdbtnDiario); rdbtnSemanal = new JRadioButton("Semanal"); rdbtnSemanal.setBounds(36, 224, 73, 32); frmReporteDeVentas.getContentPane().add(rdbtnSemanal); rdbtnMensual = new JRadioButton("Mensual"); rdbtnMensual.setBounds(36, 336, 79, 23); frmReporteDeVentas.getContentPane().add(rdbtnMensual); ButtonGroup group = new ButtonGroup(); group.add(rdbtnDiario); group.add(rdbtnSemanal); group.add(rdbtnMensual); monthChooser = new JMonthChooser(); monthChooser.setBounds(147, 336, 99, 20); frmReporteDeVentas.getContentPane().add(monthChooser); yearChooser = new JYearChooser(); yearChooser.setBounds(253, 336, 47, 20); frmReporteDeVentas.getContentPane().add(yearChooser); dayChooser = new JCalendar(); dayChooser.getDayChooser().setBorder(new LineBorder(new Color(0, 0, 0))); dayChooser.getDayChooser().getDayPanel().setBackground(Color.WHITE); dayChooser.setBounds(143, 50, 184, 130); frmReporteDeVentas.getContentPane().add(dayChooser); calendar = new JCalendar(); calendar.getDayChooser().setBorder(new LineBorder(new Color(0, 0, 0))); calendar.getDayChooser().getDayPanel().setBackground(Color.WHITE); calendar.setBounds(143, 190, 184, 130); frmReporteDeVentas.getContentPane().add(calendar); // calendar.setBackground(getForeground()); this.frmReporteDeVentas.setVisible(true); }