List of usage examples for javax.swing ImageIcon ImageIcon
public ImageIcon(byte[] imageData)
From source file:agendapoo.View.FrmMinhaAtividade.java
private void setFrameIcon() { ImageIcon icon = new ImageIcon("src//agendapoo//imgs//file_edit.png"); this.setIconImage(icon.getImage()); }
From source file:gov.nih.nci.nbia.StandaloneDM.java
private JPanel constructLoginPanel() { JPanel contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(null);/* w w w.java 2 s .c o m*/ JLabel lblNewLabel_2 = new JLabel(); lblNewLabel_2.setBounds(20, 11, 100, 100); contentPane.add(lblNewLabel_2); ImageIcon iconLogo = new ImageIcon("Images/global.logo"); lblNewLabel_2.setIcon(iconLogo); statusLbl = new JLabel( "<html>Some or all of the images you are about to download are from<br>private collection(s). Please log in first.</html>"); contentPane.add(statusLbl); statusLbl.setBounds(110, 11, 500, 42); JLabel lblNewLabel = new JLabel("User Name"); contentPane.add(lblNewLabel); lblNewLabel.setBounds(110, 79, 77, 31); userNameFld = new JTextField(); contentPane.add(userNameFld); userNameFld.setBounds(187, 75, 333, 36); userNameFld.setColumns(10); JButton submitBtn = new JButton(SubmitBtnLbl); submitBtn.addActionListener(new BtnListener()); contentPane.add(submitBtn); submitBtn.setBounds(249, 200, 139, 36); passwdFld = new JPasswordField(); contentPane.add(passwdFld); passwdFld.setBounds(187, 129, 333, 36); userNameFld.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { passwdFld.requestFocus(); } }); passwdFld.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { userId = userNameFld.getText(); password = passwdFld.getText(); if ((userId.length() < 1) || (password.length() < 1)) { statusLbl.setText("Please enter a valid user name and password."); statusLbl.setForeground(Color.red); } else submitUserCredential(userId, password); } }); JLabel lblNewLabel_1 = new JLabel("Password"); contentPane.add(lblNewLabel_1); lblNewLabel_1.setBounds(110, 129, 77, 36); return contentPane; }
From source file:EmailTree.java
public void init() { Hashtable h = new Hashtable(); Hashtable paul = new Hashtable(); paul.put("Work", addresses[0]); paul.put("Home", addresses[1]); Hashtable damian = new Hashtable(); damian.put("Work", addresses[2]); damian.put("Pager", addresses[3]); damian.put("Home", addresses[4]); Hashtable angela = new Hashtable(); angela.put("Home", addresses[5]); h.put("Paul", paul); h.put("Damian", damian); h.put("Angela", angela); tree = new JTree(h); DefaultTreeCellRenderer renderer = (DefaultTreeCellRenderer) tree.getCellRenderer(); renderer.setOpenIcon(new ImageIcon("mailboxdown.gif")); renderer.setClosedIcon(new ImageIcon("mailboxup.gif")); renderer.setLeafIcon(new ImageIcon("letter.gif")); EmailTreeCellEditor emailEditor = new EmailTreeCellEditor(); DefaultTreeCellEditor editor = new DefaultTreeCellEditor(tree, renderer, emailEditor); tree.setCellEditor(editor);//from w ww. j av a 2 s .co m tree.setEditable(true); getContentPane().add(tree, BorderLayout.CENTER); }
From source file:net.sf.keystore_explorer.gui.actions.ExportTrustedCertificatePublicKeyAction.java
/** * Construct action.//from w w w . ja v a 2s .c o m * * @param kseFrame * KeyStore Explorer frame */ public ExportTrustedCertificatePublicKeyAction(KseFrame kseFrame) { super(kseFrame); putValue(LONG_DESCRIPTION, res.getString("ExportTrustedCertificatePublicKeyAction.statusbar")); putValue(NAME, res.getString("ExportTrustedCertificatePublicKeyAction.text")); putValue(SHORT_DESCRIPTION, res.getString("ExportTrustedCertificatePublicKeyAction.tooltip")); putValue(SMALL_ICON, new ImageIcon(Toolkit.getDefaultToolkit().createImage( getClass().getResource(res.getString("ExportTrustedCertificatePublicKeyAction.image"))))); }
From source file:it.unibas.spicygui.controllo.tree.ActionShowHideFunctionalDependencies.java
public ActionShowHideFunctionalDependencies() { this.executeInjection(); this.putValue(NAME, NbBundle.getMessage(Costanti.class, Costanti.ACTION_SHOW_HIDE_FUNCTIONAL_DEPENDENCIES)); this.putValue(SMALL_ICON, new ImageIcon(ImageUtilities.loadImage(Costanti.ICONA_SHOW_HIDE_FUNCTIONAL_DEPENDENCIES))); this.putValue(Action.MNEMONIC_KEY, new Integer(java.awt.event.KeyEvent.VK_F)); this.setEnabled(false); registraAzione();/*from w w w .ja v a 2s . c o m*/ }
From source file:dialog.DialogFunctionRoom.java
/** * Creates new form DialogFunctionRoom//from w w w .java 2 s .co m * * @param parent * @param modal * @param controllerRoom */ public DialogFunctionRoom(java.awt.Frame parent, boolean modal, ControllerRoom controllerRoom) { this(parent, modal); this.mControllerRoom = controllerRoom; mType = Constant.TYPE_ADD; btnFunction.setText("Add"); btnFunction.setIcon(new ImageIcon(getClass().getResource("/images/ic_add.png"))); lbCondition.setVisible(false); cbCondition.setVisible(false); }
From source file:jasmine.imaging.core.util.Histogram.java
public void updateChart() { if (chart != null) { BufferedImage image = myChart.createBufferedImage(chart.getWidth(), chart.getHeight()); chart.setIcon(new ImageIcon(image)); }/*w ww . ja va 2 s .c o m*/ }
From source file:br.usp.poli.lta.cereda.macro.ui.Editor.java
/** * Construtor./* www . j av a 2 s.c o m*/ */ public Editor() { // define as configuraes de exibio super("Expansor de macros"); setPreferredSize(new Dimension(550, 550)); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setResizable(false); setLayout(new MigLayout()); // cria os botes e suas respectivas aes open = new JButton("Abrir", new ImageIcon(getClass().getResource("/br/usp/poli/lta/cereda/macro/images/open.png"))); save = new JButton("Salvar", new ImageIcon(getClass().getResource("/br/usp/poli/lta/cereda/macro/images/save.png"))); run = new JButton("Executar", new ImageIcon(getClass().getResource("/br/usp/poli/lta/cereda/macro/images/play.png"))); clear = new JButton("Limpar", new ImageIcon(getClass().getResource("/br/usp/poli/lta/cereda/macro/images/clear.png"))); // cria uma janela de dilogo para abrir e salvar arquivos de texto chooser = new JFileChooser(); chooser.setMultiSelectionEnabled(false); FileNameExtensionFilter filter = new FileNameExtensionFilter("Arquivos de texto", "txt", "text"); chooser.setFileFilter(filter); // ao de abertura de arquivo open.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { int value = chooser.showOpenDialog(Editor.this); if (value == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); try { String content = FileUtils.readFileToString(file); input.setText(content); output.setText(""); } catch (Exception e) { } } } }); // ao de salvamento de arquivo save.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { int value = chooser.showSaveDialog(Editor.this); if (value == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); try { FileUtils.writeStringToFile(file, input.getText(), Charset.forName("UTF-8")); output.setText(""); } catch (Exception e) { } } } }); // ao de limpeza da janela de sada clear.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { output.setText(""); } }); // ao de execuo do expansor de macros run.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent ae) { try { output.setText(MacroExpander.parse(input.getText())); } catch (Exception exception) { String out = StringUtils.rightPad("ERRO: ", 50, "-").concat("\n"); out = out.concat(WordUtils.wrap(exception.getMessage(), 50)).concat("\n"); out = out.concat(StringUtils.repeat(".", 50)).concat("\n"); output.setText(out); } } }); // tela de entrada do texto input = new RSyntaxTextArea(14, 60); input.setCodeFoldingEnabled(true); input.setWrapStyleWord(true); input.setLineWrap(true); RTextScrollPane iinput = new RTextScrollPane(input); add(iinput, "span 4, wrap"); // adiciona os botes add(open); add(save); add(run); add(clear, "wrap"); // tela de sada da expanso output = new RSyntaxTextArea(14, 60); output.setEditable(false); output.setCodeFoldingEnabled(true); output.setWrapStyleWord(true); output.setLineWrap(true); RTextScrollPane ioutput = new RTextScrollPane(output); add(ioutput, "span 4"); // ajustes finais pack(); setLocationRelativeTo(null); }
From source file:ExpenseReport.java
public ExpenseReport() { super("Expense Report"); setSize(570, 200);/*from w w w . j a v a 2 s. c o m*/ m_data = new ExpenseReportData(this); m_table = new JTable(); m_table.setAutoCreateColumnsFromModel(false); m_table.setModel(m_data); m_table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); for (int k = 0; k < ExpenseReportData.m_columns.length; k++) { TableCellRenderer renderer; if (k == ExpenseReportData.COL_APPROVED) renderer = new CheckCellRenderer(); else { DefaultTableCellRenderer textRenderer = new DefaultTableCellRenderer(); textRenderer.setHorizontalAlignment(ExpenseReportData.m_columns[k].m_alignment); renderer = textRenderer; } TableCellEditor editor; if (k == ExpenseReportData.COL_CATEGORY) editor = new DefaultCellEditor(new JComboBox(ExpenseReportData.CATEGORIES)); else if (k == ExpenseReportData.COL_APPROVED) editor = new DefaultCellEditor(new JCheckBox()); else editor = new DefaultCellEditor(new JTextField()); TableColumn column = new TableColumn(k, ExpenseReportData.m_columns[k].m_width, renderer, editor); m_table.addColumn(column); } JTableHeader header = m_table.getTableHeader(); header.setUpdateTableInRealTime(false); JScrollPane ps = new JScrollPane(); ps.setSize(550, 150); ps.getViewport().add(m_table); getContentPane().add(ps, BorderLayout.CENTER); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); ImageIcon penny = new ImageIcon("penny.gif"); m_title = new JLabel("Total: $", penny, JButton.LEFT); m_title.setForeground(Color.black); m_title.setAlignmentY(0.5f); p.add(m_title); p.add(Box.createHorizontalGlue()); JButton bt = new JButton("Insert before"); bt.setMnemonic('b'); bt.setAlignmentY(0.5f); ActionListener lst = new ActionListener() { public void actionPerformed(ActionEvent e) { int row = m_table.getSelectedRow(); m_data.insert(row); m_table.tableChanged( new TableModelEvent(m_data, row, row, TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT)); m_table.repaint(); } }; bt.addActionListener(lst); p.add(bt); bt = new JButton("Insert after"); bt.setMnemonic('a'); bt.setAlignmentY(0.5f); lst = new ActionListener() { public void actionPerformed(ActionEvent e) { int row = m_table.getSelectedRow(); m_data.insert(row + 1); m_table.tableChanged(new TableModelEvent(m_data, row + 1, row + 1, TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT)); m_table.repaint(); } }; bt.addActionListener(lst); p.add(bt); bt = new JButton("Delete row"); bt.setMnemonic('d'); bt.setAlignmentY(0.5f); lst = new ActionListener() { public void actionPerformed(ActionEvent e) { int row = m_table.getSelectedRow(); if (m_data.delete(row)) { m_table.tableChanged(new TableModelEvent(m_data, row, row, TableModelEvent.ALL_COLUMNS, TableModelEvent.INSERT)); m_table.repaint(); calcTotal(); } } }; bt.addActionListener(lst); p.add(bt); getContentPane().add(p, BorderLayout.SOUTH); calcTotal(); WindowListener wndCloser = new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }; addWindowListener(wndCloser); setVisible(true); }
From source file:jasmine.imaging.core.JasmineCorrelationGraph.java
protected void drawChart() { if (myChart != null) { BufferedImage image = myChart.createBufferedImage(getWidth(), getHeight() - 65); chart.setIcon(new ImageIcon(image)); }//from w w w. ja v a 2s . c om }