List of usage examples for javax.swing UIManager put
public static Object put(Object key, Object value)
From source file:Clavis.Windows.WShedule.java
/** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor.//from w ww . j a v a2 s . co m */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jPanelInicial = new javax.swing.JPanel(); jScrollPane1 = new javax.swing.JScrollPane(); jTable1 = new org.jdesktop.swingx.JXTable(); ; jButtonSair = new javax.swing.JButton(); jXDatePickerInicio = new org.jdesktop.swingx.JXDatePicker(); jXDatePickerFim = new org.jdesktop.swingx.JXDatePicker(); jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jButtonImprimir = new javax.swing.JButton(); jComboBoxEstado = new javax.swing.JComboBox<>(); jLabel3 = new javax.swing.JLabel(); jButtonExportar = new javax.swing.JButton(); setMinimumSize(new java.awt.Dimension(900, 600)); setSize(new java.awt.Dimension(900, 600)); jPanelInicial.setBorder(javax.swing.BorderFactory.createCompoundBorder( javax.swing.BorderFactory.createLineBorder(painelcor, 4), javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)))); jPanelInicial.setMinimumSize(new java.awt.Dimension(900, 500)); jPanelInicial.setPreferredSize(new java.awt.Dimension(900, 500)); org.jdesktop.swingx.border.DropShadowBorder dropShadowBorder1 = new org.jdesktop.swingx.border.DropShadowBorder(); dropShadowBorder1.setCornerSize(6); dropShadowBorder1.setShadowSize(3); dropShadowBorder1.setShowLeftShadow(true); jScrollPane1.setBorder(javax.swing.BorderFactory.createCompoundBorder(dropShadowBorder1, javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)))); jTable1.setBorder(null); if (mat.getTypeOfMaterial().getMaterialTypeID() == 1) { jTable1.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {}, new String[] { lingua.translate("Utilizador"), lingua.translate("Horrio"), lingua.translate("Data"), lingua.translate("Atividade"), lingua.translate("Disciplina") })); jTable1.getColumnModel().getColumn(0).setPreferredWidth(250); jTable1.getColumnModel().getColumn(1).setMinWidth(90); jTable1.getColumnModel().getColumn(2).setMinWidth(90); jTable1.getColumnModel().getColumn(3).setMinWidth(150); jTable1.getColumnModel().getColumn(4).setMinWidth(150); } else { jTable1.setModel(new javax.swing.table.DefaultTableModel(new Object[][] {}, new String[] { lingua.translate("Utilizador"), lingua.translate("Data inicial"), lingua.translate("Data final"), lingua.translate("Atividade") })); jTable1.getColumnModel().getColumn(0).setPreferredWidth(250); jTable1.getColumnModel().getColumn(1).setMinWidth(90); jTable1.getColumnModel().getColumn(2).setMinWidth(90); jTable1.getColumnModel().getColumn(3).setMinWidth(150); } jScrollPane1.setViewportView(jTable1); Border border = BorderFactory.createEmptyBorder(5, 5, 0, 0); UIManager.put("Table.focusCellHighlightBorder", border); jTable1.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); DefaultTableCellRenderer renderer = new DefaultTableCellRenderer(); renderer.setHorizontalAlignment(javax.swing.JLabel.CENTER); renderer.setFocusable(false); javax.swing.JLabel lo = new javax.swing.JLabel(); lo.setBackground(new Color(100, 100, 100)); lo.setOpaque(true); jScrollPane1.setCorner(javax.swing.JScrollPane.UPPER_TRAILING_CORNER, lo); jTable1.setRowHeight(30); jTable1.setEditable(false); jTable1.setSelectionBackground(Color.DARK_GRAY); jTable1.getColumnModel().getColumn(1).setCellRenderer(renderer); jTable1.getColumnModel().getColumn(2).setCellRenderer(renderer); jTable1.getColumnModel().getColumn(3).setCellRenderer(renderer); if (mat.getTypeOfMaterial().getMaterialTypeID() == 1) { jTable1.getColumnModel().getColumn(4).setCellRenderer(renderer); } DefaultTableCellRenderer headerRenderer = new DefaultTableCellRenderer() { private static final long serialVersionUID = 2L; @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); setFont(new Font("Cantarell", Font.PLAIN, 14)); this.setBorder(BorderFactory.createMatteBorder(0, 1, 1, 0, new Color(1, 1, 1))); return this; } }; DefaultTableCellRenderer headerRenderer2 = new DefaultTableCellRenderer() { private static final long serialVersionUID = 3L; @Override public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); setFont(new Font("Cantarell", Font.PLAIN, 14)); this.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createMatteBorder(0, 0, 1, 0, new Color(1, 1, 1)), BorderFactory.createEmptyBorder(0, 20, 0, 0))); this.setBackground(new Color(100, 100, 100)); setForeground(Color.WHITE); setPreferredSize(new Dimension(100, 40)); return this; } }; headerRenderer.setBackground(new Color(100, 100, 100)); headerRenderer.setForeground(Color.WHITE); headerRenderer.setPreferredSize(new Dimension(100, 40)); headerRenderer.setHorizontalAlignment(javax.swing.JLabel.CENTER); for (int i = 0; i < jTable1.getColumnCount(); i++) { if (i == 0) { headerRenderer2.setHorizontalAlignment(javax.swing.JLabel.LEFT); jTable1.getColumnModel().getColumn(i).setHeaderRenderer(headerRenderer2); } else { jTable1.getColumnModel().getColumn(i).setHeaderRenderer(headerRenderer); } } jButtonSair.setBackground(new java.awt.Color(1, 1, 1)); jButtonSair.setToolTipText(""); jButtonSair.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jButtonSair.setFocusPainted(false); jButtonSair.setMaximumSize(new java.awt.Dimension(90, 40)); jButtonSair.setMinimumSize(new java.awt.Dimension(90, 40)); jButtonSair.setPreferredSize(new java.awt.Dimension(90, 40)); jButtonSair.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonSairActionPerformed(evt); } }); jXDatePickerInicio.setBackground(new java.awt.Color(254, 254, 254)); org.jdesktop.swingx.border.DropShadowBorder dropShadowBorder2 = new org.jdesktop.swingx.border.DropShadowBorder(); dropShadowBorder2.setCornerSize(6); dropShadowBorder2.setShadowSize(3); dropShadowBorder2.setShowLeftShadow(true); jXDatePickerInicio.setBorder(javax.swing.BorderFactory.createCompoundBorder(dropShadowBorder2, javax.swing.BorderFactory.createMatteBorder(0, 1, 1, 1, new java.awt.Color(0, 0, 0)))); jXDatePickerInicio.setFont(new java.awt.Font("Cantarell", 0, 12)); // NOI18N jXDatePickerInicio.setMaximumSize(new java.awt.Dimension(1155551, 26)); jXDatePickerInicio.setMinimumSize(new java.awt.Dimension(66, 26)); jXDatePickerInicio.setPreferredSize(new java.awt.Dimension(131, 26)); jXDatePickerInicio.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jXDatePickerInicioActionPerformed(evt); } }); jXDatePickerFim.setBackground(new java.awt.Color(254, 254, 254)); org.jdesktop.swingx.border.DropShadowBorder dropShadowBorder3 = new org.jdesktop.swingx.border.DropShadowBorder(); dropShadowBorder3.setCornerSize(6); dropShadowBorder3.setShadowSize(3); dropShadowBorder3.setShowLeftShadow(true); jXDatePickerFim.setBorder(javax.swing.BorderFactory.createCompoundBorder(dropShadowBorder3, javax.swing.BorderFactory.createMatteBorder(0, 1, 1, 1, new java.awt.Color(0, 0, 0)))); jXDatePickerFim.setFont(new java.awt.Font("Cantarell", 0, 12)); // NOI18N jXDatePickerFim.setMaximumSize(new java.awt.Dimension(1155551, 26)); jXDatePickerFim.setMinimumSize(new java.awt.Dimension(66, 26)); jXDatePickerFim.setPreferredSize(new java.awt.Dimension(121, 26)); jLabel1.setBackground(new java.awt.Color(100, 100, 100)); jLabel1.setFont(new java.awt.Font("Cantarell", 0, 12)); // NOI18N jLabel1.setForeground(new java.awt.Color(254, 254, 254)); jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel1.setText("Incio"); jLabel1.setVerticalAlignment(javax.swing.SwingConstants.TOP); jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jLabel1.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT); jLabel1.setMaximumSize(new java.awt.Dimension(3343446, 96)); jLabel1.setMinimumSize(new java.awt.Dimension(36, 26)); jLabel1.setOpaque(true); jLabel1.setPreferredSize(new java.awt.Dimension(100, 20)); jLabel2.setBackground(new java.awt.Color(100, 100, 100)); jLabel2.setFont(new java.awt.Font("Cantarell", 0, 12)); // NOI18N jLabel2.setForeground(new java.awt.Color(254, 254, 254)); jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel2.setText("Fim"); jLabel2.setVerticalAlignment(javax.swing.SwingConstants.TOP); jLabel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jLabel2.setMaximumSize(new java.awt.Dimension(355557, 96)); jLabel2.setMinimumSize(new java.awt.Dimension(37, 26)); jLabel2.setOpaque(true); jLabel2.setPreferredSize(new java.awt.Dimension(100, 20)); jButtonImprimir.setBackground(new java.awt.Color(51, 102, 153)); jButtonImprimir.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jButtonImprimir.setFocusPainted(false); jButtonImprimir.setMaximumSize(new java.awt.Dimension(5345, 40)); jButtonImprimir.setPreferredSize(new java.awt.Dimension(90, 40)); jButtonImprimir.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonImprimirActionPerformed(evt); } }); jComboBoxEstado.setBackground(new java.awt.Color(213, 213, 213)); jComboBoxEstado.setBorder(null); jComboBoxEstado.setFocusable(false); jComboBoxEstado.setMinimumSize(new java.awt.Dimension(35, 22)); jComboBoxEstado.setPreferredSize(new java.awt.Dimension(125, 28)); jComboBoxEstado.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBoxEstadoActionPerformed(evt); } }); jLabel3.setBackground(new java.awt.Color(100, 100, 100)); jLabel3.setFont(new java.awt.Font("Cantarell", 0, 12)); // NOI18N jLabel3.setForeground(new java.awt.Color(254, 254, 254)); jLabel3.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); jLabel3.setText("Estado"); jLabel3.setVerticalAlignment(javax.swing.SwingConstants.TOP); jLabel3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0))); jLabel3.setMaximumSize(new java.awt.Dimension(355557, 96)); jLabel3.setMinimumSize(new java.awt.Dimension(37, 26)); jLabel3.setOpaque(true); jLabel3.setPreferredSize(new java.awt.Dimension(100, 20)); jButtonExportar.setBackground(new java.awt.Color(51, 102, 153)); jButtonExportar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); jButtonExportar.setFocusPainted(false); jButtonExportar.setMaximumSize(new java.awt.Dimension(5345, 40)); jButtonExportar.setPreferredSize(new java.awt.Dimension(90, 40)); jButtonExportar.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonExportarActionPerformed(evt); } }); javax.swing.GroupLayout jPanelInicialLayout = new javax.swing.GroupLayout(jPanelInicial); jPanelInicial.setLayout(jPanelInicialLayout); jPanelInicialLayout.setHorizontalGroup(jPanelInicialLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanelInicialLayout.createSequentialGroup().addGap(42, 42, 42) .addGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanelInicialLayout.createSequentialGroup().addComponent(jScrollPane1) .addGap(42, 42, 42)) .addGroup(jPanelInicialLayout.createSequentialGroup().addGap(29, 29, 29) .addComponent(jButtonSair, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jButtonExportar, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jButtonImprimir, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(71, 71, 71)))) .addGroup(jPanelInicialLayout.createSequentialGroup().addGap(71, 71, 71) .addGroup(jPanelInicialLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jXDatePickerInicio, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanelInicialLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE) .addComponent(jXDatePickerFim, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 201, Short.MAX_VALUE) .addGroup(jPanelInicialLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) .addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(jComboBoxEstado, 0, 241, Short.MAX_VALUE)) .addGap(71, 71, 71))); jPanelInicialLayout .setVerticalGroup(jPanelInicialLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanelInicialLayout.createSequentialGroup().addGap(16, 16, 16) .addGroup(jPanelInicialLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(0, 0, 0) .addGroup(jPanelInicialLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jXDatePickerInicio, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jXDatePickerFim, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jComboBoxEstado, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 465, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanelInicialLayout .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jButtonImprimir, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButtonSair, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jButtonExportar, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGap(16, 16, 16))); try { if (Clavis.KeyQuest.class.getResource("Images/exit26x24.png") != null) { BufferedImage im = ImageIO.read(Clavis.KeyQuest.class.getResourceAsStream("Images/exit26x24.png")); ImageIcon imic = new ImageIcon(im); if (imic != null) { jButtonSair.setIcon(imic); } } } catch (IOException eo) { } jButtonSair.setToolTipText(lingua.translate("Voltar")); javax.swing.JPanel pan2 = new javax.swing.JPanel(null); String compoe = lingua.translate("Hoje dia") + ": " + new TimeDate.Date().toString(); javax.swing.JLabel fil2 = new javax.swing.JLabel(compoe); fil2.setBounds(0, 0, 300, 26); fil2.setHorizontalAlignment(SwingConstants.CENTER); pan2.setPreferredSize(new Dimension(300, 30)); pan2.setBounds(0, 0, 300, 30); pan2.add(fil2); jXDatePickerInicio.setLinkPanel(pan2); jXDatePickerInicio.setLocale(lingua.systemlocale); jXDatePickerInicio.getEditor().setSelectionColor(Color.DARK_GRAY); jXDatePickerInicio.getEditor().setBorder(BorderFactory.createEmptyBorder()); jXDatePickerInicio.getEditor().setHorizontalAlignment(SwingConstants.CENTER); javax.swing.JButton bbt2 = (javax.swing.JButton) jXDatePickerInicio.getComponent(1); bbt2.setBackground(Color.WHITE); jXDatePickerInicio.addActionListener(actionJXDatePicker()); jXDatePickerInicio.setFormats("dd/MM/yyyy"); javax.swing.JPanel pan = new javax.swing.JPanel(null); String compoe0 = lingua.translate("Hoje dia") + ": " + new TimeDate.Date().toString(); javax.swing.JLabel fil = new javax.swing.JLabel(compoe); fil.setBounds(0, 0, 300, 26); fil.setHorizontalAlignment(SwingConstants.CENTER); pan.setPreferredSize(new Dimension(300, 30)); pan.setBounds(0, 0, 300, 30); pan.add(fil); jXDatePickerFim.setLinkPanel(pan); Component[] t = jXDatePickerFim.getLinkPanel().getComponents(); jXDatePickerFim.setLocale(lingua.systemlocale); jXDatePickerFim.getEditor().setSelectionColor(Color.DARK_GRAY); jXDatePickerFim.getEditor().setBorder(BorderFactory.createEmptyBorder()); jXDatePickerFim.getEditor().setHorizontalAlignment(SwingConstants.CENTER); javax.swing.JButton bbt = (javax.swing.JButton) jXDatePickerFim.getComponent(1); bbt.setBackground(Color.WHITE); jXDatePickerFim.addActionListener(actionJXDatePicker()); jXDatePickerFim.setFormats("dd/MM/yyyy"); jLabel1.setText(lingua.translate("Incio")); jLabel2.setText(lingua.translate("Fim")); try { if (Clavis.KeyQuest.class.getResource("Images/print.png") != null) { BufferedImage im = ImageIO.read(Clavis.KeyQuest.class.getResourceAsStream("Images/print.png")); ImageIcon imic = new ImageIcon(im); if (imic != null) { jButtonImprimir.setIcon(imic); } } } catch (IOException eo) { } jButtonImprimir.setToolTipText(lingua.translate("Imprimir")); jComboBoxEstado.setModel(new javax.swing.DefaultComboBoxModel<>( new String[] { lingua.translate("todos"), lingua.translate("terminado"), lingua.translate("no realizado"), lingua.translate("por realizar") })); Clavis.KeyQuest.addVisualComboBox(jComboBoxEstado); ((javax.swing.JLabel) jComboBoxEstado.getRenderer()).setHorizontalAlignment(javax.swing.JLabel.CENTER); jLabel3.setText(lingua.translate("Estado")); try { if (Clavis.KeyQuest.class.getResource("Images/exportar.png") != null) { BufferedImage im = ImageIO.read(Clavis.KeyQuest.class.getResourceAsStream("Images/exportar.png")); ImageIcon imic = new ImageIcon(im); if (imic != null) { jButtonExportar.setIcon(imic); } } } catch (IOException eo) { } jButtonExportar.setToolTipText(lingua.translate("Exportar para excel")); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup().addComponent(jPanelInicial, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGap(0, 0, 0))); layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jPanelInicial, javax.swing.GroupLayout.DEFAULT_SIZE, 600, Short.MAX_VALUE)); }
From source file:com.softeffect.primemovers.ui.ClientApplication.java
/** * Method called by LoginDialog to notify the sucessful login. * //from ww w.jav a 2s.c om * @param loginInfo * login information, like username, password, ... */ public void loginSuccessful(Map loginInfo) { MDIFrame mdi = new MDIFrame(this); try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); /* Turn off metal's use of bold fonts */ UIManager.put("swing.boldMetal", Boolean.FALSE); SwingUtilities.updateComponentTreeUI(mdi); } catch (Throwable ex) { ex.printStackTrace(); } }
From source file:net.sf.jhylafax.JHylaFAX.java
public static void initializeToolkit() { // configure UI properties UIManager.put("swing.boldMetal", Boolean.FALSE); UIManager.put("SplitPaneDivider.border", new BasicBorders.MarginBorder()); UIManager.put("TitledBorder.font", UIManager.getFont("Label.font").deriveFont(Font.BOLD)); UIManager.put("TitledBorder.titleColor", UIManager.getColor("Label.foreground").brighter()); Builder.setProperty(DefaultFactory.ENHANCED_TEXT_FIELD_MENU_KEY, true); }
From source file:LocationSensitiveDemo.java
private static void increaseFont(String type) { Font font = UIManager.getFont(type); font = font.deriveFont(font.getSize() + 4f); UIManager.put(type, font); }
From source file:iqq.app.core.service.impl.SkinServiceImpl.java
@Override public void setDefaultFont(Font vFont) { UIManager.put("ToolTip.font", vFont); UIManager.put("Table.font", vFont); UIManager.put("TableHeader.font", vFont); UIManager.put("TextField.font", vFont); UIManager.put("ComboBox.font", vFont); UIManager.put("TextField.font", vFont); UIManager.put("PasswordField.font", vFont); UIManager.put("TextArea.font", vFont); UIManager.put("TextPane.font", vFont); UIManager.put("EditorPane.font", vFont); UIManager.put("FormattedTextField.font", vFont); UIManager.put("Button.font", vFont); UIManager.put("CheckBox.font", vFont); UIManager.put("RadioButton.font", vFont); UIManager.put("ToggleButton.font", vFont); UIManager.put("ProgressBar.font", vFont); UIManager.put("DesktopIcon.font", vFont); UIManager.put("TitledBorder.font", vFont); UIManager.put("Label.font", vFont); UIManager.put("List.font", vFont); UIManager.put("TabbedPane.font", vFont); UIManager.put("MenuBar.font", vFont); UIManager.put("Menu.font", vFont); UIManager.put("MenuItem.font", vFont); UIManager.put("PopupMenu.font", vFont); UIManager.put("CheckBoxMenuItem.font", vFont); UIManager.put("RadioButtonMenuItem.font", vFont); UIManager.put("Spinner.font", vFont); UIManager.put("Tree.font", vFont); UIManager.put("ToolBar.font", vFont); UIManager.put("OptionPane.messageFont", vFont); UIManager.put("OptionPane.buttonFont", vFont); UIManager.put("Tree.paintLines", false); // Tree UIManager.put("Tree.leftChildIndent", 0); // UIManager.put("Tree.arrowDown", getIconByKey("main/arrowDown")); // Tree UIManager.put("Tree.arrowLeft", getIconByKey("main/arrowLeft")); // WebLookAndFeel.globalControlFont = vFont; WebLookAndFeel.globalTextFont = vFont; WebLookAndFeel.globalTitleFont = vFont; WebLookAndFeel.globalTooltipFont = vFont; WebLookAndFeel.globalAcceleratorFont = vFont; WebLookAndFeel.menuItemAcceleratorFont = vFont; WebLookAndFeel.globalAlertFont = vFont; WebLookAndFeel.globalMenuFont = vFont; // ?weblaf//from w w w. j ava 2s. c om WebLookAndFeel.setDecorateAllWindows(false); WebLookAndFeel.install(); Locale.setDefault(Locale.CHINA); }
From source file:tn.mariages.gui.Accueil.java
/** * @param args the command line arguments *///w w w . j a va 2 s . c o m public static void main(String args[]) { /* Set the Nimbus look and feel */ //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "> /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } // javax.swing.UIManager.setLookAndFeel(WebLookAndFeel.class.getCanonicalName()); } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(AjoutProduit.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(AjoutProduit.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(AjoutProduit.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(AjoutProduit.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //</editor-fold> try { org.jb2011.lnf.beautyeye.BeautyEyeLNFHelper.launchBeautyEyeLNF(); UIManager.put("RootPane.setupButtonVisible", false); } catch (Exception e) { //TODO exception } /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { Accueil ac = new Accueil(); int h = Toolkit.getDefaultToolkit().getScreenSize().height; int w = Toolkit.getDefaultToolkit().getScreenSize().width; ac.setLocation(0, 0); ac.setSize(144, h + 16); ac.setExtendedState(ac.MAXIMIZED_HORIZ); ac.setVisible(true); } }); }
From source file:cytoscape.CyMain.java
License:asdf
protected void setupLookAndFeel() { try {// w w w . j ava 2 s . c o m if (LookUtils.IS_OS_WINDOWS) { /* * For Windows: just use platform default look & feel. */ UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } else if (LookUtils.IS_OS_MAC) { /* * For Mac: move menu bar to OS X default bar (next to Apple * icon) */ System.setProperty("apple.laf.useScreenMenuBar", "true"); } else { final JavaVersion javaVersion = JavaVersion.getJavaVersion(); if (javaVersion.getMajor() >= 2 || javaVersion.getMinor() > 6 || (javaVersion.getMinor() == 6 && javaVersion.getUpdate() >= 10)) UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); else { /* * For Unix platforms, use JGoodies Looks */ UIManager.setLookAndFeel(new Plastic3DLookAndFeel()); Plastic3DLookAndFeel.set3DEnabled(true); Plastic3DLookAndFeel.setCurrentTheme(new com.jgoodies.looks.plastic.theme.SkyBluer()); Plastic3DLookAndFeel.setTabStyle(Plastic3DLookAndFeel.TAB_STYLE_METAL_VALUE); Plastic3DLookAndFeel.setHighContrastFocusColorsEnabled(true); Options.setDefaultIconSize(new Dimension(18, 18)); Options.setHiResGrayFilterEnabled(true); Options.setPopupDropShadowEnabled(true); Options.setUseSystemFonts(true); UIManager.put("Button.defaultButtonFollowsFocus", Boolean.TRUE); UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, Boolean.TRUE); } } } catch (Exception e) { logger.warn("Can't set look & feel:" + e.getMessage(), e); } }
From source file:com.maxl.java.amikodesk.AMiKoDesk.java
public static void main(String[] args) { // Initialize globales m_application_data_folder = Utilities.appDataFolder(); favorite_meds_set = new HashSet<String>(); favorite_data = new DataStore(m_application_data_folder); favorite_meds_set = favorite_data.load(); // HashSet containing registration numbers // Register toolkit Toolkit tk = Toolkit.getDefaultToolkit(); tk.addAWTEventListener(WindowSaver.getInstance(m_application_data_folder), AWTEvent.WINDOW_EVENT_MASK); // Specify command line options Options options = new Options(); addOption(options, "help", "print this message", false, false); addOption(options, "version", "print the version information and exit", false, false); addOption(options, "port", "starts AmiKo-server at given port", true, false); addOption(options, "width", "sets window width", true, false); addOption(options, "height", "sets window height", true, false); addOption(options, "lang", "use given language", true, false); addOption(options, "type", "start light or full app", true, false); addOption(options, "title", "display medical info related to given title", true, false); addOption(options, "eancode", "display medical info related to given 13-digit ean-code", true, false); addOption(options, "regnr", "display medical info related to given 5-digit registration number", true, false);/*from w w w . j a va 2 s. c o m*/ // Activate command line parser commandLineParse(options, args); // Initialize language files if (Utilities.appLanguage().equals("de")) m_rb = ResourceBundle.getBundle("amiko_de_CH", new Locale("de", "CH")); else if (Utilities.appLanguage().equals("fr")) m_rb = ResourceBundle.getBundle("amiko_fr_CH", new Locale("fr", "CH")); if (Utilities.appCustomization().equals("desitin")) { new SplashWindow(Constants.APP_NAME, 5000); } else if (Utilities.appCustomization().equals("meddrugs")) { new SplashWindow(Constants.APP_NAME, 5000); } else if (Utilities.appCustomization().equals("zurrose")) { new SplashWindow(Constants.APP_NAME, 3000); } // Load javascript String jscript_str = FileOps.readFromFile(Constants.JS_FOLDER + "main_callbacks.js"); m_jscript_str = "<script language=\"javascript\">" + jscript_str + "</script>"; // Load css style sheet m_css_str = "<style>" + FileOps.readFromFile(Constants.CSS_SHEET) + "</style>"; // Load main database m_sqldb = new MainSqlDb(); // Attempt to load alternative database. if db does not exist, load // default database // These databases are NEVER zipped! if (m_sqldb.loadDBFromPath(m_application_data_folder + "\\" + Constants.DEFAULT_AMIKO_DB_BASE + Utilities.appLanguage() + ".db") == 0) { System.out.println("Loading default amiko database"); if (Utilities.appLanguage().equals("de")) m_sqldb.loadDB("de"); else if (Utilities.appLanguage().equals("fr")) m_sqldb.loadDB("fr"); } // Load rose database if (Utilities.appCustomization().equals("zurrose")) { m_rosedb = new RoseSqlDb(); if (m_rosedb.loadDBFromPath(m_application_data_folder + "\\" + Constants.DEFAULT_ROSE_DB) == 0) { System.out.println("Loading default rose db"); m_rosedb.loadDB(); } } // Initialize update class m_maindb_update = new UpdateDb(m_sqldb); // Create shop folder in application data folder File wdir = new File(m_application_data_folder + "\\shop"); if (!wdir.exists()) wdir.mkdirs(); // Load interaction cart m_interactions_cart = new InteractionsCart(); // Create shopping cart and load related files m_shopping_cart = new ShoppingCart(); loadAuthors(); m_emailer = new Emailer(m_rb); // Create comparison cart and load related files m_comparison_cart = new ComparisonCart(); // Preferences m_prefs = Preferences.userRoot().node(SettingsPage.class.getName()); // UIUtils.setPreferredLookAn dFeel(); NativeInterface.open(); NativeSwing.initialize(); // Setup font size based on screen size UIManager.getLookAndFeelDefaults().put("defaultFont", new Font("Dialog", Font.PLAIN, 14)); UIManager.put("Label.font", new Font("Dialog", Font.PLAIN, 12)); UIManager.put("CheckBox.font", new Font("Dialog", Font.PLAIN, 12)); UIManager.put("Button.font", new Font("Dialog", Font.BOLD, 14)); UIManager.put("ToggleButton.font", new Font("Dialog", Font.BOLD, 14)); UIManager.put("ToggleButton.select", m_selected_but_color); UIManager.put("Menu.font", new Font("Dialog", Font.PLAIN, 12)); UIManager.put("MenuBar.font", new Font("Dialog", Font.PLAIN, 12)); UIManager.put("MenuItem.font", new Font("Dialog", Font.PLAIN, 12)); UIManager.put("ToolBar.font", new Font("Dialog", Font.PLAIN, 12)); // Schedule a job for the event-dispatching thread: // creating and showing this application's GUI javax.swing.SwingUtilities.invokeLater(new Runnable() { @Override public void run() { if (!commandLineOptionsProvided()) { System.out.println("No relevant command line options provided... creating full GUI"); createAndShowFullGUI(); } else if (CML_OPT_TYPE.equals("full")) { System.out.println("Creating full GUI"); createAndShowFullGUI(); } else if (CML_OPT_TYPE.equals("light")) { System.out.println("Creating light GUI"); createAndShowLightGUI(); } } }); NativeInterface.runEventPump(); }
From source file:net.pms.newgui.LooksFrame.java
/** * Constructs a <code>DemoFrame</code>, configures the UI, * and builds the content./*from w w w .java 2 s . c om*/ */ public LooksFrame(AutoUpdater autoUpdater, @Nonnull PmsConfiguration configuration, @Nonnull WindowPropertiesConfiguration windowConfiguration) { super(windowConfiguration.getGraphicsConfiguration()); if (configuration == null) { throw new IllegalArgumentException("configuration can't be null"); } setResizable(true); windowProperties = new WindowProperties(this, STANDARD_SIZE, MINIMUM_SIZE, windowConfiguration); this.autoUpdater = autoUpdater; this.configuration = configuration; assert this.configuration != null; setMinimumSize(MINIMUM_SIZE); Options.setDefaultIconSize(new Dimension(18, 18)); Options.setUseNarrowButtons(true); // Set view level, can be omitted if ViewLevel is implemented in configuration // by setting the view level as variable initialization if (configuration.isHideAdvancedOptions()) { viewLevel = ViewLevel.NORMAL; } else { viewLevel = ViewLevel.ADVANCED; } // Global options Options.setTabIconsEnabled(true); UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, null); // Swing Settings initializeLookAndFeel(); // wait till the look and feel has been initialized before (possibly) displaying the update notification dialog if (autoUpdater != null) { autoUpdater.addObserver(this); autoUpdater.pollServer(); } // Shared Fonts final Integer twelve = Integer.valueOf(12); final Integer fontPlain = Integer.valueOf(Font.PLAIN); final Integer fontBold = Integer.valueOf(Font.BOLD); LazyValue dialogPlain12 = new LazyValue() { @Override public Object createValue(UIDefaults t) { return new FontUIResource(Font.DIALOG, fontPlain, twelve); } }; LazyValue sansSerifPlain12 = new LazyValue() { @Override public Object createValue(UIDefaults t) { return new FontUIResource(Font.SANS_SERIF, fontPlain, twelve); } }; LazyValue monospacedPlain12 = new LazyValue() { @Override public Object createValue(UIDefaults t) { return new FontUIResource(Font.MONOSPACED, fontPlain, twelve); } }; LazyValue dialogBold12 = new LazyValue() { @Override public Object createValue(UIDefaults t) { return new FontUIResource(Font.DIALOG, fontBold, twelve); } }; Object MenuFont = dialogPlain12; Object FixedControlFont = monospacedPlain12; Object ControlFont = dialogPlain12; Object MessageFont = dialogPlain12; Object WindowFont = dialogBold12; Object ToolTipFont = sansSerifPlain12; Object IconFont = ControlFont; // Override our fonts with a unicode font for languages with special characters final String language = configuration.getLanguageTag(); if (language != null && (language.equals("ja") || language.startsWith("zh") || language.equals("ko"))) { // http://propedit.sourceforge.jp/propertieseditor.jnlp MenuFont = sansSerifPlain12; FixedControlFont = sansSerifPlain12; ControlFont = sansSerifPlain12; MessageFont = sansSerifPlain12; WindowFont = sansSerifPlain12; IconFont = sansSerifPlain12; } UIManager.put("Button.font", ControlFont); UIManager.put("CheckBox.font", ControlFont); UIManager.put("CheckBoxMenuItem.font", MenuFont); UIManager.put("ComboBox.font", ControlFont); UIManager.put("EditorPane.font", ControlFont); UIManager.put("FileChooser.listFont", IconFont); UIManager.put("FormattedTextField.font", ControlFont); UIManager.put("InternalFrame.titleFont", WindowFont); UIManager.put("Label.font", ControlFont); UIManager.put("List.font", ControlFont); UIManager.put("PopupMenu.font", MenuFont); UIManager.put("Menu.font", MenuFont); UIManager.put("MenuBar.font", MenuFont); UIManager.put("MenuItem.font", MenuFont); UIManager.put("MenuItem.acceleratorFont", MenuFont); UIManager.put("RadioButton.font", ControlFont); UIManager.put("RadioButtonMenuItem.font", MenuFont); UIManager.put("OptionPane.font", MessageFont); UIManager.put("OptionPane.messageFont", MessageFont); UIManager.put("OptionPane.buttonFont", MessageFont); UIManager.put("Panel.font", ControlFont); UIManager.put("PasswordField.font", ControlFont); UIManager.put("ProgressBar.font", ControlFont); UIManager.put("ScrollPane.font", ControlFont); UIManager.put("Slider.font", ControlFont); UIManager.put("Spinner.font", ControlFont); UIManager.put("TabbedPane.font", ControlFont); UIManager.put("Table.font", ControlFont); UIManager.put("TableHeader.font", ControlFont); UIManager.put("TextArea.font", FixedControlFont); UIManager.put("TextField.font", ControlFont); UIManager.put("TextPane.font", ControlFont); UIManager.put("TitledBorder.font", ControlFont); UIManager.put("ToggleButton.font", ControlFont); UIManager.put("ToolBar.font", MenuFont); UIManager.put("ToolTip.font", ToolTipFont); UIManager.put("Tree.font", ControlFont); UIManager.put("Viewport.font", ControlFont); setTitle("Test"); setIconImage(readImageIcon("icon-32.png").getImage()); setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); JComponent jp = buildContent(); String showScrollbars = System.getProperty("scrollbars", "").toLowerCase(); /** * Handle scrollbars: * * 1) forced scrollbars (-Dscrollbars=true): always display them * 2) optional scrollbars (-Dscrollbars=optional): display them as needed * 3) otherwise (default): don't display them */ switch (showScrollbars) { case "true": setContentPane(new JScrollPane(jp, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS)); break; case "optional": setContentPane(new JScrollPane(jp, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED)); break; default: setContentPane(jp); break; } String projectName = PropertiesUtil.getProjectProperties().get("project.name"); String projectVersion = PropertiesUtil.getProjectProperties().get("project.version"); String title = projectName + " " + projectVersion; // If the version contains a "-" (e.g. "1.50.1-SNAPSHOT" or "1.50.1-beta1"), add a warning message if (projectVersion.indexOf('-') > -1) { title = title + " - " + Messages.getString("LooksFrame.26"); } if (PMS.getTraceMode() == 2) { // Forced trace mode title = title + " [" + Messages.getString("TracesTab.10").toUpperCase() + "]"; } setTitle(title); setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); // Display tooltips immediately and for a long time ToolTipManager.sharedInstance().setInitialDelay(400); ToolTipManager.sharedInstance().setDismissDelay(60000); ToolTipManager.sharedInstance().setReshowDelay(400); if (!configuration.isMinimized() && System.getProperty(START_SERVICE) == null) { setVisible(true); } BasicSystemUtils.INSTANCE.addSystemTray(this); }
From source file:de.xplib.xdbm.ui.Application.java
/** * Sets global user interface options./*from w w w .j a v a 2s .co m*/ */ private void configureUI() { Options.setDefaultIconSize(new Dimension(18, 18)); // Set font options UIManager.put(Options.USE_SYSTEM_FONTS_APP_KEY, settings.isUseSystemFonts()); Options.setGlobalFontSizeHints(settings.getFontSizeHints()); Options.setUseNarrowButtons(settings.isUseNarrowButtons()); Options.setPopupDropShadowEnabled(settings.isPopupDropShadowEnabled().booleanValue()); // Global options Options.setTabIconsEnabled(settings.isTabIconsEnabled()); UIManager.put(Options.POPUP_DROP_SHADOW_ENABLED_KEY, settings.isPopupDropShadowEnabled()); // Swing Settings LookAndFeel selectedLaf = settings.getSelectedLookAndFeel(); if (selectedLaf instanceof PlasticLookAndFeel) { PlasticLookAndFeel.setMyCurrentTheme(settings.getSelectedTheme()); PlasticLookAndFeel.setTabStyle(settings.getPlasticTabStyle()); PlasticLookAndFeel.setHighContrastFocusColorsEnabled(settings.isPlasticHighContrastFocusEnabled()); } else if (selectedLaf.getClass() == MetalLookAndFeel.class) { MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); } // Work around caching in MetalRadioButtonUI JRadioButton radio = new JRadioButton(); radio.getUI().uninstallUI(radio); JCheckBox checkBox = new JCheckBox(); checkBox.getUI().uninstallUI(checkBox); try { UIManager.setLookAndFeel(selectedLaf); } catch (Exception e) { System.out.println("Can't change L&F: " + e); } }