List of usage examples for javax.swing JScrollPane setViewportView
public void setViewportView(Component view)
From source file:com.floreantpos.ui.views.CookingInstructionSelectionView.java
private void createUI() { setTitle(Messages.getString("CookingInstructionSelectionView.1")); setTitlePaneText(Messages.getString("CookingInstructionSelectionView.1")); //$NON-NLS-1$ getContentPanel().setBorder(new EmptyBorder(10, 20, 0, 20)); JScrollPane scrollPane = new JScrollPane(); table = new JTable(); table.setRowHeight(35);//from w w w. ja v a2 s .co m scrollPane.setViewportView(table); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { int index = table.getSelectedRow(); if (index < 0) return; CookingInstructionTableModel model = (CookingInstructionTableModel) table.getModel(); CookingInstruction cookingInstruction = model.rowsList.get(index); tfCookingInstruction.setText(cookingInstruction.getDescription()); } }); tfCookingInstruction.addKeyListener(new KeyListener() { @Override public void keyTyped(KeyEvent e) { doFilter(); } @Override public void keyReleased(KeyEvent e) { doFilter(); } @Override public void keyPressed(KeyEvent e) { } }); PosButton btnSave = new PosButton(IconFactory.getIcon("save.png")); btnSave.setText(POSConstants.SAVE.toUpperCase()); btnSave.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { String instruction = tfCookingInstruction.getText(); if (instruction == null || instruction.isEmpty()) { POSMessageDialog.showMessage(Application.getPosWindow(), "Instruction cannot be empty."); return; } CookingInstruction cookingInstruction = new CookingInstruction(); cookingInstruction.setDescription(instruction); CookingInstructionDAO.getInstance().save(cookingInstruction); updateView(); CookingInstructionTableModel model = (CookingInstructionTableModel) table.getModel(); table.getSelectionModel().addSelectionInterval(model.getRowCount() - 1, model.getRowCount() - 1); } }); JPanel contentPanel = new JPanel(new MigLayout("fill,wrap 1,inset 0")); contentPanel.add(scrollPane, "grow"); contentPanel.add(tfCookingInstruction, "h 35!,split 2,grow"); contentPanel.add(btnSave, "h 35!,w 90!"); QwertyKeyPad keyPad = new QwertyKeyPad(); contentPanel.add(keyPad, "grow"); getContentPanel().add(contentPanel); }
From source file:com.ixora.common.ui.ShowExceptionDialog.java
/** * Initializes this dialog.//from w w w . ja v a2 s . c o m */ private void initialize() { this.eventHandler = new EventHandler(); setSize(smallSize); setTitle(MessageRepository.get(Msg.COMMON_UI_TEXT_ERROR)); if (isDefaultLookAndFeelDecorated()) { getRootPane().setWindowDecorationStyle(JRootPane.ERROR_DIALOG); } textExceptionLong = UIFactoryMgr.createHtmlPane(); textExceptionLong.setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6)); textExceptionLong.setEditable(false); textExceptionLong.addHyperlinkListener(this.eventHandler); textExceptionShort = UIFactoryMgr.createTextField(); textExceptionShort.setHorizontalAlignment(JTextField.CENTER); textExceptionShort.setBorder(null); textExceptionShort.setEditable(false); panel = new JPanel(new CardLayout()); JScrollPane s = UIFactoryMgr.createScrollPane(); s.setBorder(null); s.setViewportView(textExceptionLong); panel.add(s, "long"); panel.add(textExceptionShort, "short"); // set background color to the color of the panel textExceptionShort.setBackground(panel.getBackground()); textExceptionLong.setBackground(panel.getBackground()); buildContentPane(); }
From source file:hermes.browser.actions.AbstractFIXBrowserDocumentComponent.java
protected Component createHexPanel(FIXMessage m) { final JTextArea textArea = new JTextArea(); textArea.setEditable(false);//from w w w .j a v a 2s . c o m textArea.setFont(Font.decode("Monospaced-PLAIN-12")); byte[] bytes = null; try { textArea.setText(DumpUtils.dumpBinary(m.getBytes(), DumpUtils.DUMP_AS_HEX_AND_ALPHA)); } catch (Throwable e) { textArea.setText(e.getMessage()); log.error("exception converting message to byte[]: ", e); } textArea.setCaretPosition(0); final JScrollPane scrollPane = new JScrollPane(); scrollPane.setViewportView(textArea); return scrollPane; }
From source file:org.tinymediamanager.ui.dialogs.FeedbackDialog.java
/** * Instantiates a new feedback dialog./*from w w w .j a v a2 s . c om*/ */ public FeedbackDialog() { super(BUNDLE.getString("Feedback"), "feedback"); //$NON-NLS-1$ setBounds(100, 100, 450, 320); getContentPane().setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(400px;min):grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:max(250px;min):grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, })); JPanel panelContent = new JPanel(); getContentPane().add(panelContent, "2, 2, fill, fill"); panelContent.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.PARAGRAPH_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.NARROW_LINE_GAP_ROWSPEC, RowSpec.decode("default:grow"), })); JLabel lblName = new JLabel(BUNDLE.getString("Feedback.name")); //$NON-NLS-1$ panelContent.add(lblName, "2, 2, right, default"); tfName = new JTextField(); panelContent.add(tfName, "4, 2, fill, default"); tfName.setColumns(10); JLabel lblEmailoptional = new JLabel(BUNDLE.getString("Feedback.email")); //$NON-NLS-1$ panelContent.add(lblEmailoptional, "2, 4, right, default"); tfEmail = new JTextField(); panelContent.add(tfEmail, "4, 4, fill, default"); tfEmail.setColumns(10); // pre-fill dialog if (Globals.isDonator()) { Properties p = License.decrypt(); tfEmail.setText(p.getProperty("email")); tfName.setText(p.getProperty("user")); } JLabel lblFeedback = new JLabel(BUNDLE.getString("Feedback.message")); //$NON-NLS-1$ panelContent.add(lblFeedback, "2, 6, 3, 1"); JScrollPane scrollPane = new JScrollPane(); panelContent.add(scrollPane, "2, 8, 3, 1, fill, fill"); textArea = new JTextArea(); scrollPane.setViewportView(textArea); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); JPanel panelButtons = new JPanel(); panelButtons.setLayout(new EqualsLayout(5)); getContentPane().add(panelButtons, "2, 4, fill, fill"); JButton btnSend = new JButton(BUNDLE.getString("Feedback")); //$NON-NLS-1$ btnSend.setIcon(IconManager.APPLY); btnSend.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { // check if feedback is provided if (StringUtils.isEmpty(textArea.getText())) { JOptionPane.showMessageDialog(null, BUNDLE.getString("Feedback.message.empty")); //$NON-NLS-1$ return; } // send feedback HttpClient client = TmmHttpClient.getHttpClient(); HttpPost post = new HttpPost( "https://script.google.com/macros/s/AKfycbxTIhI58gwy0UJ0Z1CdmZDdHlwBDU_vugBmQxcKN9aug4nfgrgZ/exec"); try { List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(1); StringBuilder message = new StringBuilder("Feedback from "); message.append(tfName.getText()); message.append("\nEmail:"); message.append(tfEmail.getText()); message.append("\n"); message.append("\nis Donator?: "); message.append(Globals.isDonator()); message.append("\nVersion: "); message.append(ReleaseInfo.getRealVersion()); message.append("\nBuild: "); message.append(ReleaseInfo.getRealBuildDate()); message.append("\nOS: "); message.append(System.getProperty("os.name")); message.append(" "); message.append(System.getProperty("os.version")); message.append("\nJDK: "); message.append(System.getProperty("java.version")); message.append(" "); message.append(System.getProperty("java.vendor")); message.append("\nUUID: "); message.append(System.getProperty("tmm.uuid")); message.append("\n\n"); message.append(textArea.getText()); nameValuePairs.add(new BasicNameValuePair("message", message.toString())); nameValuePairs.add(new BasicNameValuePair("sender", tfEmail.getText())); post.setEntity(new UrlEncodedFormEntity(nameValuePairs, "UTF-8")); HttpResponse response = client.execute(post); HttpEntity entity = response.getEntity(); EntityUtils.consume(entity); } catch (IOException e) { LOGGER.error("failed sending feedback: " + e.getMessage()); JOptionPane.showMessageDialog(null, BUNDLE.getString("Feedback.send.error") + "\n" + e.getMessage()); //$NON-NLS-1$ return; } JOptionPane.showMessageDialog(null, BUNDLE.getString("Feedback.send.ok")); //$NON-NLS-1$ setVisible(false); } }); panelButtons.add(btnSend); JButton btnCacnel = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ btnCacnel.setIcon(IconManager.CANCEL); btnCacnel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }); panelButtons.add(btnCacnel); }
From source file:com.ln.gui.Notifylist.java
@SuppressWarnings("unchecked") public Notifylist() { setDefaultCloseOperation(DISPOSE_ON_CLOSE); setResizable(false);//ww w . ja v a2 s .c o m setIconImage(Toolkit.getDefaultToolkit().getImage(Configuration.mydir + "\\resources\\icons\\ln6464.png")); setTitle("Event list"); DateFormat dd = new SimpleDateFormat("dd"); DateFormat dh = new SimpleDateFormat("HH"); DateFormat dm = new SimpleDateFormat("mm"); Date day = new Date(); Date hour = new Date(); Date minute = new Date(); int dayd = Integer.parseInt(dd.format(day)); int hourh = Integer.parseInt(dh.format(hour)); int minutem = Integer.parseInt(dm.format(minute)); int daydiff = dayd - Main.dayd; int hourdiff = hourh - Main.hourh; int mindiff = minutem - Main.minutem; model.clear(); Events = new String[Main.events]; Events2 = new String[Main.events]; // Events = Main.Eventlist; for (int i = 0; i != Main.events; i++) { Events[i] = Main.Eventlist[i]; } for (int i = 0; i != Main.events; i++) { Events2[i] = Main.Eventlist[i]; } for (int i = 0; i != Events2.length; i++) { if (Events2[i] != null) { Events2[i] = Main.Eventlist[i]; Events2[i] = Events2[i].replace(StringUtils.substringBetween(Events2[i], "in: ", " Days"), Integer .toString(Integer.parseInt(StringUtils.substringBetween(Events2[i], "in: ", " Days")))); Events2[i] = Events2[i].replace(StringUtils.substringBetween(Events2[i], "Days ", " Hours"), Integer .toString(Integer.parseInt(StringUtils.substringBetween(Events2[i], "Days ", " Hours")))); Events2[i] = Events2[i].replace(StringUtils.substringBetween(Events2[i], "Hours ", " Minutes"), Integer.toString( Integer.parseInt(StringUtils.substringBetween(Events2[i], "Hours ", " Minutes")))); } if (Events[i] != null) { Events[i] = Main.Eventlist[i]; Events[i] = Events[i].replace(StringUtils.substringBetween(Events[i], "in: ", " Days"), Integer.toString(Integer.parseInt(StringUtils.substringBetween(Events[i], "in: ", " Days")) - daydiff)); Events[i] = Events[i].replace(StringUtils.substringBetween(Events[i], "Days ", " Hours"), Integer.toString( Integer.parseInt(StringUtils.substringBetween(Events[i], "Days ", " Hours")) - hourdiff)); Events[i] = Events[i].replace(StringUtils.substringBetween(Events[i], "Hours ", " Minutes"), Integer.toString( Integer.parseInt(StringUtils.substringBetween(Events[i], "Hours ", " Minutes")) - mindiff)); //Arrays.sort(Events); model.add(i, Events[i]); } } setBounds(100, 100, 671, 331); contentPane = new JPanel(); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); JButton Remove = new JButton("Remove selected"); Remove.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (list.getSelectedIndices().length > 0) { int[] tmp = list.getSelectedIndices(); Main.events = Main.events - tmp.length; int[] selectedIndices = list.getSelectedIndices(); for (int i = tmp.length - 1; i >= 0; i--) { selectedIndices = list.getSelectedIndices(); model.removeElementAt(selectedIndices[i]); Events = ArrayUtils.remove(Events, selectedIndices[i]); Events2 = ArrayUtils.remove(Events2, selectedIndices[i]); Main.Eventlist = ArrayUtils.remove(Main.Eventlist, selectedIndices[i]); //http://i.imgur.com/lN2Fe.jpg } } } }); Remove.setBounds(382, 258, 130, 25); contentPane.add(Remove); JButton btnClose = new JButton("Close"); btnClose.setBounds(522, 258, 130, 25); contentPane.add(btnClose); btnClose.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { dispose(); } }); try { JScrollPane scrollPane = new JScrollPane(); scrollPane.setBounds(10, 11, 642, 236); contentPane.add(scrollPane); list.setBorder(new BevelBorder(BevelBorder.LOWERED, null, null, null, null)); list.setBounds(10, 11, 642, 46); scrollPane.setViewportView(list); scrollPane.getVerticalScrollBar().setValue(0); } catch (NullPointerException e) { } }
From source file:com.igormaznitsa.nbmindmap.nb.swing.PlainTextEditor.java
private Component makeEditorForText(final Document document) { if (this.lastEditor != null) { this.lastEditor.removeCaretListener(this); }// w ww. j a v a 2 s. c o m this.lastEditor = UI_COMPO_FACTORY.makeEditorPane(); this.lastEditor.setEditorKit(getEditorKit()); this.lastEditor.setDocument(document); this.lastEditor.addCaretListener(this); final Component result; if (document instanceof NbDocument.CustomEditor) { NbDocument.CustomEditor ce = (NbDocument.CustomEditor) document; result = ce.createEditor(this.lastEditor); } else { final JScrollPane scroll = UI_COMPO_FACTORY.makeScrollPane(); scroll.setViewportView(this.lastEditor); result = scroll; } this.caretUpdate(null); return result; }
From source file:net.sf.firemox.ui.wizard.About.java
/** * Creates a new instance of About <br> * //from ww w .j a v a 2 s . c o m * @param parent */ public About(JFrame parent) { super(LanguageManager.getString("wiz_about.title"), LanguageManager.getString("wiz_about.description"), "mp64.gif", LanguageManager.getString("close"), 420, 620); JPanel thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setMaximumSize(new Dimension(32767, 26)); thanksPanel.setOpaque(false); JLabel jLabel5 = new JLabel(LanguageManager.getString("version") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(jLabel5); jLabel5 = new JLabel(IdConst.VERSION); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setOpaque(false); JPanel thanksPanelLeft = new JPanel(new FlowLayout(FlowLayout.LEADING)); thanksPanelLeft.setLayout(new BoxLayout(thanksPanelLeft, BoxLayout.Y_AXIS)); thanksPanelLeft.setMaximumSize(new Dimension(100, 2000)); thanksPanelLeft.setMinimumSize(new Dimension(100, 16)); jLabel5 = new JLabel(LanguageManager.getString("thanks") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanelLeft.add(jLabel5); thanksPanel.add(thanksPanelLeft); thanksPanelLeft = new JPanel(); thanksPanelLeft.setLayout(new BoxLayout(thanksPanelLeft, BoxLayout.Y_AXIS)); StringBuilder contributors = new StringBuilder(); addContributor(contributors, "Fabrice Daugan", "developper", "france"); addContributor(contributors, "Hoani Cross", "developper", "frenchpolynesia"); addContributor(contributors, "nico100", "graphist", "france"); addContributor(contributors, "seingalt_tm", "graphist", "france"); addContributor(contributors, "surtur2", "tester", null); addContributor(contributors, "Jan Blaha", "developper", "cz"); addContributor(contributors, "Tureba", "developper", "brazil"); addContributor(contributors, "hakvf", "tester", "france"); addContributor(contributors, "Stefano \"Kismet\" Lenzi", "developper", "italian"); jLabel5 = new JLabel(contributors.toString()); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.LEFT); thanksPanelLeft.add(jLabel5); jLabel5 = new JLink("http://obsidiurne.free.fr", "morgil has designed the splash screen"); jLabel5.setFont(MToolKit.defaultFont); thanksPanelLeft.add(jLabel5); thanksPanel.add(thanksPanelLeft); gameParamPanel.add(thanksPanel); thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setMaximumSize(new Dimension(32767, 26)); thanksPanel.setOpaque(false); JLabel blanklbl = new JLabel(); blanklbl.setHorizontalAlignment(SwingConstants.RIGHT); blanklbl.setMaximumSize(new Dimension(100, 16)); blanklbl.setMinimumSize(new Dimension(100, 16)); blanklbl.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(blanklbl); jLabel5 = new JLink( "http://sourceforge.net/tracker/?func=add&group_id=" + IdConst.PROJECT_ID + "&atid=601043", LanguageManager.getString("joindev")); jLabel5.setFont(MToolKit.defaultFont); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setOpaque(false); jLabel5 = new JLabel(LanguageManager.getString("projecthome") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(jLabel5); jLabel5 = new JLink(IdConst.MAIN_PAGE, IdConst.MAIN_PAGE); jLabel5.setFont(MToolKit.defaultFont); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); // forum francais thanksPanel = new JPanel(); thanksPanel.setLayout(new BoxLayout(thanksPanel, BoxLayout.X_AXIS)); thanksPanel.setOpaque(false); jLabel5 = new JLabel(LanguageManager.getString("othersites") + " : "); jLabel5.setFont(MToolKit.defaultFont); jLabel5.setHorizontalAlignment(SwingConstants.RIGHT); jLabel5.setMaximumSize(new Dimension(100, 16)); jLabel5.setMinimumSize(new Dimension(100, 16)); jLabel5.setPreferredSize(new Dimension(100, 16)); thanksPanel.add(jLabel5); jLabel5 = new JLink("http://www.Firemox.fr.st", UIHelper.getIcon("mpfrsml.gif"), SwingConstants.LEFT); jLabel5.setToolTipText(LanguageManager.getString("frenchforum.tooltip")); thanksPanel.add(jLabel5); jLabel5 = new JLabel(); jLabel5.setMaximumSize(new Dimension(1000, 16)); thanksPanel.add(jLabel5); gameParamPanel.add(thanksPanel); JTextArea disclaimer = new JTextArea(); disclaimer.setEditable(false); disclaimer.setLineWrap(true); disclaimer.setWrapStyleWord(true); disclaimer.setAutoscrolls(true); disclaimer.setTabSize(2); disclaimer.setFont(new Font("Arial", 0, 10)); // Then try and read it locally BufferedReader inGPL = null; try { inGPL = new BufferedReader(new InputStreamReader(MToolKit.getResourceAsStream(IdConst.FILE_LICENSE))); disclaimer.read(inGPL, ""); } catch (IOException e) { e.printStackTrace(); } finally { IOUtils.closeQuietly(inGPL); } JScrollPane disclaimerSPanel = new JScrollPane(); disclaimerSPanel.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); MToolKit.addOverlay(disclaimerSPanel); disclaimerSPanel.setViewportView(disclaimer); gameParamPanel.add(disclaimerSPanel); }
From source file:com.floreantpos.customer.DefaultCustomerListView.java
public void initUI() { setLayout(new MigLayout("fill", "[grow]", "[grow][grow][grow]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ JPanel searchPanel = new JPanel(new MigLayout()); JLabel lblByPhone = new JLabel(Messages.getString("CustomerSelectionDialog.1")); //$NON-NLS-1$ JLabel lblByLoyality = new JLabel(Messages.getString("CustomerSelectionDialog.16")); //$NON-NLS-1$ JLabel lblByName = new JLabel(Messages.getString("CustomerSelectionDialog.19")); //$NON-NLS-1$ tfMobile = new POSTextField(16); tfLoyaltyNo = new POSTextField(16); tfName = new POSTextField(16); tfName.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSearchCustomer();/*from w w w.j a v a 2 s .co m*/ } }); tfLoyaltyNo.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSearchCustomer(); } }); tfMobile.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSearchCustomer(); } }); PosButton btnSearch = new PosButton(Messages.getString("CustomerSelectionDialog.15")); //$NON-NLS-1$ btnSearch.setFocusable(false); btnSearch.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doSearchCustomer(); } }); PosButton btnKeyboard = new PosButton(IconFactory.getIcon("/images/", "keyboard.png")); //$NON-NLS-1$ //$NON-NLS-2$ btnKeyboard.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { qwertyKeyPad.setCollapsed(!qwertyKeyPad.isCollapsed()); } }); searchPanel.add(lblByPhone, "growy"); //$NON-NLS-1$ searchPanel.add(tfMobile, "growy"); //$NON-NLS-1$ searchPanel.add(lblByLoyality, "growy"); //$NON-NLS-1$ searchPanel.add(tfLoyaltyNo, "growy"); //$NON-NLS-1$ searchPanel.add(lblByName, "growy"); //$NON-NLS-1$ searchPanel.add(tfName, "growy"); //$NON-NLS-1$ searchPanel.add(btnKeyboard, "growy,w " + PosUIManager.getSize(80) + "!,h " + PosUIManager.getSize(35) + "!"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ searchPanel.add(btnSearch, ",growy,h " + PosUIManager.getSize(35) + "!"); //$NON-NLS-1$ //$NON-NLS-2$ add(searchPanel, "cell 0 1"); //$NON-NLS-1$ JPanel centerPanel = new JPanel(new BorderLayout()); centerPanel.setBorder(new TitledBorder(null, POSConstants.SELECT_CUSTOMER.toUpperCase(), TitledBorder.LEADING, TitledBorder.TOP, null, null)); //$NON-NLS-1$ JPanel customerListPanel = new JPanel(new BorderLayout(0, 0)); customerListPanel.setBorder(new EmptyBorder(5, 5, 0, 5)); customerTable = new CustomerTable(); customerTable.setModel(new CustomerListTableModel()); customerTable.setFocusable(false); customerTable.setRowHeight(60); customerTable.getTableHeader().setPreferredSize(new Dimension(100, 35)); customerTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); customerTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { selectedCustomer = customerTable.getSelectedCustomer(); if (selectedCustomer != null) { //btnInfo.setEnabled(true); } else { btnInfo.setEnabled(false); } } }); JScrollPane scrollPane = new JScrollPane(); scrollPane.setFocusable(false); scrollPane.setViewportView(customerTable); customerListPanel.add(scrollPane, BorderLayout.CENTER); JPanel panel = new JPanel(new MigLayout("hidemode 3,al center", "sg", "")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ btnInfo = new PosButton(Messages.getString("CustomerSelectionDialog.23")); //$NON-NLS-1$ btnInfo.setFocusable(false); panel.add(btnInfo, "grow"); //$NON-NLS-1$ btnInfo.setEnabled(false); PosButton btnHistory = new PosButton(Messages.getString("CustomerSelectionDialog.24")); //$NON-NLS-1$ btnHistory.setEnabled(false); panel.add(btnHistory, "grow"); //$NON-NLS-1$ btnCreateNewCustomer = new PosButton(Messages.getString("CustomerSelectionDialog.25")); //$NON-NLS-1$ btnCreateNewCustomer.setFocusable(false); panel.add(btnCreateNewCustomer, "grow"); //$NON-NLS-1$ btnCreateNewCustomer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doCreateNewCustomer(); } }); btnRemoveCustomer = new PosButton(Messages.getString("CustomerSelectionDialog.26")); //$NON-NLS-1$ btnRemoveCustomer.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doRemoveCustomerFromTicket(); } }); panel.add(btnRemoveCustomer, "grow"); //$NON-NLS-1$ PosButton btnSelect = new PosButton(Messages.getString("CustomerSelectionDialog.28")); //$NON-NLS-1$ btnSelect.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (isCreateNewTicket()) { doCreateNewTicket(); } else { closeDialog(false); } } }); panel.add(btnSelect, "grow"); //$NON-NLS-1$ btnCancel = new PosButton(Messages.getString("CustomerSelectionDialog.29")); //$NON-NLS-1$ btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { closeDialog(true); } }); panel.add(btnCancel, "grow"); //$NON-NLS-1$ customerListPanel.add(panel, BorderLayout.SOUTH); centerPanel.add(customerListPanel, BorderLayout.CENTER); //$NON-NLS-1$ add(centerPanel, "cell 0 2,grow"); //$NON-NLS-1$ qwertyKeyPad = new com.floreantpos.swing.QwertyKeyPad(); qwertyKeyPad.setCollapsed(false); add(qwertyKeyPad, "cell 0 3,grow"); //$NON-NLS-1$ }
From source file:regresiones.RegresionMultiple.java
private void pintar(Double[] Yestimada, JTabbedPane resultados, Double[][] auxiliar) { // mostramos resultados para la pestaa resultados*********************************************************************** JPanel panel = new JPanel(new BorderLayout()); panel.setBackground(Color.white); JLabel titulo = new JLabel("Resultados");//creamos el titulo panel.add(titulo, BorderLayout.PAGE_START);//lo agregamos al inicio jtable = new JTable();//creamos la tabla a mostrar jtable.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 0, 0), 2, true)); jtable.setFont(new java.awt.Font("Arial", 1, 14)); jtable.setColumnSelectionAllowed(true); jtable.setCursor(new java.awt.Cursor(java.awt.Cursor.N_RESIZE_CURSOR)); jtable.setInheritsPopupMenu(true);/*from w w w.j ava 2 s. com*/ jtable.setMinimumSize(new java.awt.Dimension(80, 80)); String[] titulos = { "X1", "X2", "Y", "Y estimada", "X1^2", "X2^2", "X1*Y", "X2*Y", "Y-Y estimada" };//los titulos de la tabla arregloFinal = new String[N][9]; DecimalFormat formato = new DecimalFormat("0.00"); for (int i = 0; i < N; i++) {//armamos el arreglo arregloFinal[i][0] = datos[i][0] + ""; arregloFinal[i][1] = datos[i][1] + ""; arregloFinal[i][2] = datos[i][2] + ""; arregloFinal[i][3] = formato.format(Yestimada[i]); arregloFinal[i][4] = formato.format(auxiliar[i][0]); arregloFinal[i][5] = formato.format(auxiliar[i][1]); arregloFinal[i][6] = formato.format(auxiliar[i][2]); arregloFinal[i][7] = formato.format(auxiliar[i][3]); arregloFinal[i][8] = formato.format(auxiliar[i][4]); } DefaultTableModel TableModel = new DefaultTableModel(arregloFinal, titulos); jtable.setModel(TableModel); JScrollPane jScrollPane1 = new JScrollPane(); jScrollPane1.setViewportView(jtable); jtable.getColumnModel().getSelectionModel() .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); panel.add(jScrollPane1, BorderLayout.CENTER); JPanel panel2 = new JPanel(new GridLayout(0, 6));//creo un panel con rejilla de 4 columnas JLabel etiquetaN = new JLabel("N"); JTextField cajaN = new JTextField(); cajaN.setText(N + ""); cajaN.setEditable(false); JLabel etiquetaK = new JLabel("K"); JTextField cajaK = new JTextField(); cajaK.setText("2"); cajaK.setEditable(false); JLabel etiquetab0 = new JLabel("b0"); JTextField cajab0 = new JTextField(); cajab0.setText(formato.format(b0) + ""); cajab0.setEditable(false); JLabel etiquetab1 = new JLabel("b1"); JTextField cajab1 = new JTextField(); cajab1.setText(formato.format(b1) + ""); cajab1.setEditable(false); JLabel etiquetab2 = new JLabel("b2"); JTextField cajab2 = new JTextField(); cajab2.setText(formato.format(b2) + ""); cajab2.setEditable(false); JLabel etiquetaSe = new JLabel("Se"); JTextField cajaSe = new JTextField(); cajaSe.setText(Se + ""); cajaSe.setEditable(false); cajaSe.setAutoscrolls(true); JButton botonI = new JButton("Exportar a PDF"); botonI.addActionListener(this); panel2.add(etiquetaN); panel2.add(cajaN); panel2.add(etiquetaK); panel2.add(cajaK); panel2.add(etiquetab2); panel2.add(etiquetab0); panel2.add(cajab0); panel2.add(etiquetab1); panel2.add(cajab1); panel2.add(etiquetab2); panel2.add(cajab2); panel2.add(etiquetaSe); panel2.add(cajaSe); panel2.add(botonI); panel.add(panel2, BorderLayout.SOUTH);//agrego el panel2 con rejilla en el panel principal al sur resultados.addTab("resultado", panel); //************************************************************************************** //intervalos de confianza JPanel intervalos = new JPanel(new BorderLayout()); JPanel variables = new JPanel(new GridLayout(0, 2)); JLabel variableX1 = new JLabel("X1"); cajaVariableX1 = new JTextField(); JLabel variableX2 = new JLabel("X2"); cajaVariableX2 = new JTextField(); boton = new JButton("calcular"); boton.addActionListener(this); JLabel variableEfectividad = new JLabel("Efectividad"); String[] efectividades = { "80", "85", "90", "95", "99" }; combo = new JComboBox(efectividades); variables.add(variableX1); variables.add(cajaVariableX1); variables.add(variableX2); variables.add(cajaVariableX2); variables.add(variableEfectividad); variables.add(combo); variables.add(boton); intervalos.add(variables, BorderLayout.NORTH); jtable2 = new JTable();//creamos la tabla a mostrar jtable2.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(255, 0, 0), 2, true)); jtable2.setFont(new java.awt.Font("Arial", 1, 14)); jtable2.setColumnSelectionAllowed(true); jtable2.setCursor(new java.awt.Cursor(java.awt.Cursor.N_RESIZE_CURSOR)); jtable2.setInheritsPopupMenu(true); jtable2.setMinimumSize(new java.awt.Dimension(80, 80)); String[] titulos2 = { "Y estimada", "Li", "Ls" };//los titulos de la tabla String[][] pruebaIntervalos = { { "", "", "" } }; DefaultTableModel TableModel2 = new DefaultTableModel(pruebaIntervalos, titulos2); jtable2.setModel(TableModel2); JScrollPane jScrollPane2 = new JScrollPane(); jScrollPane2.setViewportView(jtable2); jtable2.getColumnModel().getSelectionModel() .setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION); intervalos.add(jScrollPane2, BorderLayout.CENTER); resultados.addTab("intervalos", intervalos); //*************************************************************************** JPanel graficas = new JPanel(new GridLayout(0, 1)); XYDataset dataset = createSampleDataset(Yestimada, 1); JFreeChart chart = ChartFactory.createXYLineChart("Grafica 1 - X1", "X", "Y", dataset, PlotOrientation.VERTICAL, true, false, false); XYPlot plot = (XYPlot) chart.getPlot(); XYLineAndShapeRenderer renderer = new XYLineAndShapeRenderer(); renderer.setSeriesLinesVisible(0, true); renderer.setSeriesShapesVisible(0, true); renderer.setSeriesLinesVisible(1, true); renderer.setSeriesShapesVisible(1, true); plot.setRenderer(renderer); final ChartPanel chartPanel = new ChartPanel(chart); chartPanel.setPreferredSize(new java.awt.Dimension(500, 300)); graficas.add(chartPanel);//agregamos la primer grafica //********** creamos la segunda grafica XYDataset dataset2 = createSampleDataset(Yestimada, 2); JFreeChart chart2 = ChartFactory.createXYLineChart("Grafica 2 -X2", "X", "Y", dataset2, PlotOrientation.VERTICAL, true, false, false); XYPlot plot2 = (XYPlot) chart2.getPlot(); XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(); renderer2.setSeriesLinesVisible(0, true); renderer2.setSeriesShapesVisible(0, true); renderer2.setSeriesLinesVisible(1, true); renderer2.setSeriesShapesVisible(1, true); plot2.setRenderer(renderer2); final ChartPanel chartPanel2 = new ChartPanel(chart2); chartPanel2.setPreferredSize(new java.awt.Dimension(500, 300)); graficas.add(chartPanel2); resultados.addTab("graficas", graficas); }
From source file:eu.lp0.cursus.ui.AboutDialog.java
private void initialise() { setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); setTitle(Messages.getString("about.title", Constants.APP_DESC)); //$NON-NLS-1$ DefaultUnitConverter duc = DefaultUnitConverter.getInstance(); FormLayout layout = new FormLayout("2dlu, pref, fill:pref:grow, max(30dlu;pref), 2dlu", //$NON-NLS-1$ "2dlu, max(15dlu;pref), 2dlu, max(15dlu;pref), 2dlu, fill:max(100dlu;pref):grow, 2dlu, max(16dlu;pref), 2dlu"); //$NON-NLS-1$ getContentPane().setLayout(layout);/*www . j av a 2 s . c om*/ JLabel lblName = new JLabel(Constants.APP_NAME + ": " + Messages.getString("about.description")); //$NON-NLS-1$ //$NON-NLS-2$ getContentPane().add(lblName, "2, 2, 3, 1"); //$NON-NLS-1$ getContentPane().add(new LinkJButton(Constants.APP_URL), "2, 4"); //$NON-NLS-1$ JScrollPane scrCopying = new JScrollPane(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); getContentPane().add(scrCopying, "2, 6, 3, 1"); //$NON-NLS-1$ JTextArea txtCopying = new JTextArea(loadResources("COPYRIGHT", "LICENCE")); //$NON-NLS-1$ //$NON-NLS-2$ txtCopying.setFont(Font.decode(Font.MONOSPACED)); txtCopying.setEditable(false); scrCopying.setViewportView(txtCopying); scrCopying.setPreferredSize( new Dimension(scrCopying.getPreferredSize().width, duc.dialogUnitYAsPixel(100, scrCopying))); Action actClose = new CloseDialogAction(this); JButton btnClose = new JButton(actClose); getContentPane().add(btnClose, "4, 8"); //$NON-NLS-1$ getRootPane().setDefaultButton(btnClose); getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW) .put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), CloseDialogAction.class.getName()); getRootPane().getActionMap().put(CloseDialogAction.class.getName(), actClose); pack(); setMinimumSize(getSize()); setSize(getSize().width, getSize().height * 3 / 2); btnClose.requestFocusInWindow(); }