List of usage examples for javax.swing JTextArea JTextArea
public JTextArea(Document doc)
From source file:com.floreantpos.ui.forms.QuickCustomerForm.java
private void createCustomerForm() { setLayout(new BorderLayout(10, 10)); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); setOpaque(true);// w w w . j a v a2s . co m JPanel inputPanel = new JPanel(); inputPanel.setLayout(new MigLayout("insets 10 10 10 10", "[][][][]", "[][][][][]")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ inputPanel.setBorder(BorderFactory.createTitledBorder("Enter Customer Information")); JLabel lblAddress = new JLabel(Messages.getString("CustomerForm.18")); //$NON-NLS-1$ tfAddress = new JTextArea(new FixedLengthDocument(220)); JScrollPane scrlDescription = new JScrollPane(tfAddress); scrlDescription.setPreferredSize(PosUIManager.getSize(338, 52)); JLabel lblZip = new JLabel(Messages.getString("CustomerForm.21")); //$NON-NLS-1$ tfZip = new FixedLengthTextField(30); JLabel lblCitytown = new JLabel(Messages.getString("CustomerForm.24")); //$NON-NLS-1$ tfCity = new FixedLengthTextField(); JLabel lblState = new JLabel(Messages.getString("QuickCustomerForm.0")); //$NON-NLS-1$ tfState = new JTextField(30); JLabel lblCellPhone = new JLabel(Messages.getString("CustomerForm.32")); //$NON-NLS-1$ inputPanel.add(lblCellPhone, "cell 0 1,alignx right"); //$NON-NLS-1$ tfCellPhone = new JTextField(30); inputPanel.add(tfCellPhone, "cell 1 1"); //$NON-NLS-1$ //setPreferredSize(PosUIManager.getSize(800, 350)); JLabel lblFirstName = new JLabel(Messages.getString("CustomerForm.3")); //$NON-NLS-1$ //inputPanel.add(lblFirstName, "cell 0 2,alignx right"); //$NON-NLS-1$ tfFirstName = new FixedLengthTextField(); //inputPanel.add(tfFirstName, "cell 1 2"); //$NON-NLS-1$ JLabel lblLastName = new JLabel(Messages.getString("CustomerForm.11")); //$NON-NLS-1$ //inputPanel.add(lblLastName, "cell 0 3,alignx right"); //$NON-NLS-1$ tfLastName = new FixedLengthTextField(); //inputPanel.add(tfLastName, "cell 1 3"); //$NON-NLS-1$ JLabel lblName = new JLabel("Name"); //$NON-NLS-1$ inputPanel.add(lblName, "cell 0 3,alignx right"); //$NON-NLS-1$ tfName = new FixedLengthTextField(); tfName.setLength(120); inputPanel.add(tfName, "cell 1 3"); //$NON-NLS-1$ inputPanel.add(lblZip, "cell 0 4,right"); //$NON-NLS-1$ inputPanel.add(tfZip, "cell 1 4"); //$NON-NLS-1$ inputPanel.add(lblCitytown, "cell 0 5,right"); //$NON-NLS-1$ inputPanel.add(tfCity, "cell 1 5"); //$NON-NLS-1$ inputPanel.add(lblState, "cell 0 6,right"); //$NON-NLS-1$ inputPanel.add(tfState, "cell 1 6"); //$NON-NLS-1$ inputPanel.add(lblAddress, "cell 2 1 1 6,right"); //$NON-NLS-1$ inputPanel.add(scrlDescription, "grow, cell 3 1 1 6"); //$NON-NLS-1$ qwertyKeyPad = new QwertyKeyPad(); add(inputPanel, BorderLayout.CENTER); if (isKeypad) { add(qwertyKeyPad, BorderLayout.SOUTH); //$NON-NLS-1$ } tfZip.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { getStateAndCityByZipCode(); } }); tfZip.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { getStateAndCityByZipCode(); } @Override public void focusGained(FocusEvent e) { } }); enableCustomerFields(false); callOrderController(); }
From source file:io.github.tavernaextras.biocatalogue.integration.config.BioCataloguePluginConfigurationPanel.java
private void initialiseUI() { this.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.NORTHWEST; c.weightx = 1.0;//from ww w . ja va 2 s . com c.gridx = 0; c.gridy = 0; JTextArea taDescription = new JTextArea("Configure the Service Catalogue integration functionality"); taDescription.setFont(taDescription.getFont().deriveFont(Font.PLAIN, 11)); taDescription.setLineWrap(true); taDescription.setWrapStyleWord(true); taDescription.setEditable(false); taDescription.setFocusable(false); taDescription.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); this.add(taDescription, c); c.gridy++; c.insets = new Insets(20, 0, 0, 0); JLabel jlBioCatalogueAPIBaseURL = new JLabel("Base URL of the Service Catalogue instance to connect to:"); this.add(jlBioCatalogueAPIBaseURL, c); c.gridy++; c.insets = new Insets(0, 0, 0, 0); tfBioCatalogueAPIBaseURL = new JTextField(); this.add(tfBioCatalogueAPIBaseURL, c); c.gridy++; c.insets = new Insets(30, 0, 0, 0); // We are not removing BioCatalogue services from its config panel any more - // they are being handled by the Taverna's Service Registry // JButton bForgetStoredServices = new JButton("Forget services added to Service Panel by BioCatalogue Plugin"); // bForgetStoredServices.addActionListener(new ActionListener() { // public void actionPerformed(ActionEvent e) // { // int response = JOptionPane.showConfirmDialog(null, // no way T2ConfigurationFrame instance can be obtained to be used as a parent... // "Are you sure you want to clear all SOAP operations and REST methods\n" + // "that were added to the Service Panel by the BioCatalogue Plugin?\n\n" + // "This action is permanent is cannot be undone.\n\n" + // "Do you want to proceed?", "BioCatalogue Plugin", JOptionPane.YES_NO_OPTION); // // if (response == JOptionPane.YES_OPTION) // { // BioCatalogueServiceProvider.clearRegisteredServices(); // JOptionPane.showMessageDialog(null, // no way T2ConfigurationFrame instance can be obtained to be used as a parent... // "Stored services have been successfully cleared, but will remain\n" + // "being shown in Service Panel during this session.\n\n" + // "They will not appear in the Service Panel after you restart Taverna.", // "BioCatalogue Plugin", JOptionPane.INFORMATION_MESSAGE); // } // } // }); // this.add(bForgetStoredServices, c); JButton bLoadDefaults = new JButton("Load Defaults"); bLoadDefaults.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { loadDefaults(); } }); JButton bReset = new JButton("Reset"); bReset.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { resetFields(); } }); JButton bApply = new JButton("Apply"); bApply.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { applyChanges(); } }); JPanel jpActionButtons = new JPanel(); jpActionButtons.add(bLoadDefaults); jpActionButtons.add(bReset); jpActionButtons.add(bApply); c.insets = new Insets(30, 0, 0, 0); c.gridy++; c.weighty = 1.0; this.add(jpActionButtons, c); }
From source file:com.googlecode.logVisualizer.chart.StatDevelopmentChartMouseEventListener.java
public void chartMouseClicked(final ChartMouseEvent e) { if (e.getEntity() instanceof XYItemEntity) { final XYItemEntity entity = (XYItemEntity) e.getEntity(); final int turnNumber = entity.getDataset().getX(0, entity.getItem()).intValue(); Turn turn = null;//from w w w . j a v a 2 s. c o m if (logData.isDetailedLog()) for (final SingleTurn st : logData.getTurnsSpent()) { if (st.getTurnNumber() == turnNumber) { turn = st; break; } } else for (final TurnInterval ti : logData.getTurnIntervalsSpent()) if (ti.getEndTurn() == turnNumber) { turn = ti; break; } EquipmentChange equipment = null; if (logData.isDetailedLog()) equipment = ((SingleTurn) turn).getUsedEquipment(); final StringBuilder str = new StringBuilder(250); str.append("Turn spent in area: " + turn.getAreaName() + "\n"); if (logData.isDetailedLog()) str.append("Encounter name: " + ((SingleTurn) turn).getEncounterName() + "\n"); str.append("Stats gained: " + turn.getStatGain() + "\n"); if (logData.isDetailedLog()) { str.append("Familiar used: " + ((SingleTurn) turn).getUsedFamiliar().getFamiliarName() + "\n\n"); str.append("Equipment:\n"); str.append(" Hat: " + equipment.getHat() + "\n"); str.append(" Weapon: " + equipment.getWeapon() + "\n"); str.append(" Offhand: " + equipment.getOffhand() + "\n"); str.append(" Shirt: " + equipment.getShirt() + "\n"); str.append(" Pants: " + equipment.getPants() + "\n"); str.append(" Acc1: " + equipment.getAcc1() + "\n"); str.append(" Acc2: " + equipment.getAcc2() + "\n"); str.append(" Acc3: " + equipment.getAcc3() + "\n"); str.append(" FamEquip: " + equipment.getFamEquip() + "\n"); } str.append("\nConsumables used:\n"); for (final Consumable c : turn.getConsumablesUsed()) str.append(" " + c + "\n"); str.append("\nItems dropped:\n"); for (final Item i : turn.getDroppedItems()) str.append(" " + i + "\n"); final JScrollPane text = new JScrollPane(new JTextArea(str.toString())); text.setPreferredSize(new Dimension(500, 450)); JOptionPane.showMessageDialog(null, text, "Information on " + turn, JOptionPane.INFORMATION_MESSAGE); } }
From source file:components.TextSamplerDemo.java
public TextSamplerDemo() { setLayout(new BorderLayout()); //Create a regular text field. JTextField textField = new JTextField(10); textField.setActionCommand(textFieldString); textField.addActionListener(this); //Create a password field. JPasswordField passwordField = new JPasswordField(10); passwordField.setActionCommand(passwordFieldString); passwordField.addActionListener(this); //Create a formatted text field. JFormattedTextField ftf = new JFormattedTextField(java.util.Calendar.getInstance().getTime()); ftf.setActionCommand(textFieldString); ftf.addActionListener(this); //Create some labels for the fields. JLabel textFieldLabel = new JLabel(textFieldString + ": "); textFieldLabel.setLabelFor(textField); JLabel passwordFieldLabel = new JLabel(passwordFieldString + ": "); passwordFieldLabel.setLabelFor(passwordField); JLabel ftfLabel = new JLabel(ftfString + ": "); ftfLabel.setLabelFor(ftf);// w w w. ja va 2 s . c o m //Create a label to put messages during an action event. actionLabel = new JLabel("Type text in a field and press Enter."); actionLabel.setBorder(BorderFactory.createEmptyBorder(10, 0, 0, 0)); //Lay out the text controls and the labels. JPanel textControlsPane = new JPanel(); GridBagLayout gridbag = new GridBagLayout(); GridBagConstraints c = new GridBagConstraints(); textControlsPane.setLayout(gridbag); JLabel[] labels = { textFieldLabel, passwordFieldLabel, ftfLabel }; JTextField[] textFields = { textField, passwordField, ftf }; addLabelTextRows(labels, textFields, gridbag, textControlsPane); c.gridwidth = GridBagConstraints.REMAINDER; //last c.anchor = GridBagConstraints.WEST; c.weightx = 1.0; textControlsPane.add(actionLabel, c); textControlsPane.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createTitledBorder("Text Fields"), BorderFactory.createEmptyBorder(5, 5, 5, 5))); //Create a text area. JTextArea textArea = new JTextArea("This is an editable JTextArea. " + "A text area is a \"plain\" text component, " + "which means that although it can display text " + "in any font, all of the text is in the same font."); textArea.setFont(new Font("Serif", Font.ITALIC, 16)); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); JScrollPane areaScrollPane = new JScrollPane(textArea); areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); areaScrollPane.setPreferredSize(new Dimension(250, 250)); areaScrollPane.setBorder(BorderFactory.createCompoundBorder( BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Plain Text"), BorderFactory.createEmptyBorder(5, 5, 5, 5)), areaScrollPane.getBorder())); //Create an editor pane. JEditorPane editorPane = createEditorPane(); JScrollPane editorScrollPane = new JScrollPane(editorPane); editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); editorScrollPane.setPreferredSize(new Dimension(250, 145)); editorScrollPane.setMinimumSize(new Dimension(10, 10)); //Create a text pane. JTextPane textPane = createTextPane(); JScrollPane paneScrollPane = new JScrollPane(textPane); paneScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); paneScrollPane.setPreferredSize(new Dimension(250, 155)); paneScrollPane.setMinimumSize(new Dimension(10, 10)); //Put the editor pane and the text pane in a split pane. JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, editorScrollPane, paneScrollPane); splitPane.setOneTouchExpandable(true); splitPane.setResizeWeight(0.5); JPanel rightPane = new JPanel(new GridLayout(1, 0)); rightPane.add(splitPane); rightPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createTitledBorder("Styled Text"), BorderFactory.createEmptyBorder(5, 5, 5, 5))); //Put everything together. JPanel leftPane = new JPanel(new BorderLayout()); leftPane.add(textControlsPane, BorderLayout.PAGE_START); leftPane.add(areaScrollPane, BorderLayout.CENTER); add(leftPane, BorderLayout.LINE_START); add(rightPane, BorderLayout.LINE_END); }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmSwing.CFCrmSwingTagAskDeleteJPanel.java
public CFCrmSwingTagAskDeleteJPanel(ICFCrmSwingSchema argSchema, ICFCrmTagObj argFocus) { super();// www .j av a 2 s. com final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; // Construct the various objects textAreaMessage = new JTextArea("Are you sure you want to delete this Tag?"); actionOk = new ActionOk(); actionCancel = new ActionCancel(); buttonOk = new JButton(actionOk); buttonCancel = new JButton(actionCancel); attrJPanel = argSchema.getTagFactory().newAttrJPanel(argFocus); scrollPane = new CFHSlaveJScrollPane(attrJPanel); // Lay out the widgets setSize(1024, 480); Dimension min = new Dimension(480, 300); setMinimumSize(min); add(textAreaMessage); textAreaMessage.setBounds(0, 0, 1024, 50); int xparts = (768 - (2 * 125)) / 3; add(buttonOk); buttonOk.setBounds(xparts, 55, 125, 40); add(buttonCancel); buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40); add(scrollPane); scrollPane.setBounds(0, 100, 1024, 480 - 100); }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmSwing.CFCrmSwingTldAskDeleteJPanel.java
public CFCrmSwingTldAskDeleteJPanel(ICFCrmSwingSchema argSchema, ICFCrmTldObj argFocus) { super();/*from www. j ava 2s . co m*/ final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; // Construct the various objects textAreaMessage = new JTextArea("Are you sure you want to delete this Top Level Domain?"); actionOk = new ActionOk(); actionCancel = new ActionCancel(); buttonOk = new JButton(actionOk); buttonCancel = new JButton(actionCancel); attrJPanel = argSchema.getTldFactory().newAttrJPanel(argFocus); scrollPane = new CFHSlaveJScrollPane(attrJPanel); // Lay out the widgets setSize(1024, 480); Dimension min = new Dimension(480, 300); setMinimumSize(min); add(textAreaMessage); textAreaMessage.setBounds(0, 0, 1024, 50); int xparts = (768 - (2 * 125)) / 3; add(buttonOk); buttonOk.setBounds(xparts, 55, 125, 40); add(buttonCancel); buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40); add(scrollPane); scrollPane.setBounds(0, 100, 1024, 480 - 100); }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmSwing.CFCrmSwingMemoAskDeleteJPanel.java
public CFCrmSwingMemoAskDeleteJPanel(ICFCrmSwingSchema argSchema, ICFCrmMemoObj argFocus) { super();//from www . ja v a 2 s. c o m final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; // Construct the various objects textAreaMessage = new JTextArea("Are you sure you want to delete this Memo?"); actionOk = new ActionOk(); actionCancel = new ActionCancel(); buttonOk = new JButton(actionOk); buttonCancel = new JButton(actionCancel); attrJPanel = argSchema.getMemoFactory().newAttrJPanel(argFocus); scrollPane = new CFHSlaveJScrollPane(attrJPanel); // Lay out the widgets setSize(1024, 480); Dimension min = new Dimension(480, 300); setMinimumSize(min); add(textAreaMessage); textAreaMessage.setBounds(0, 0, 1024, 50); int xparts = (768 - (2 * 125)) / 3; add(buttonOk); buttonOk.setBounds(xparts, 55, 125, 40); add(buttonCancel); buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40); add(scrollPane); scrollPane.setBounds(0, 100, 1024, 480 - 100); }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmSwing.CFCrmSwingPhoneAskDeleteJPanel.java
public CFCrmSwingPhoneAskDeleteJPanel(ICFCrmSwingSchema argSchema, ICFCrmPhoneObj argFocus) { super();// w ww . ja v a 2 s . c o m final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; // Construct the various objects textAreaMessage = new JTextArea("Are you sure you want to delete this Phone?"); actionOk = new ActionOk(); actionCancel = new ActionCancel(); buttonOk = new JButton(actionOk); buttonCancel = new JButton(actionCancel); attrJPanel = argSchema.getPhoneFactory().newAttrJPanel(argFocus); scrollPane = new CFHSlaveJScrollPane(attrJPanel); // Lay out the widgets setSize(1024, 480); Dimension min = new Dimension(480, 300); setMinimumSize(min); add(textAreaMessage); textAreaMessage.setBounds(0, 0, 1024, 50); int xparts = (768 - (2 * 125)) / 3; add(buttonOk); buttonOk.setBounds(xparts, 55, 125, 40); add(buttonCancel); buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40); add(scrollPane); scrollPane.setBounds(0, 100, 1024, 480 - 100); }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmSwing.CFCrmSwingDomainAskDeleteJPanel.java
public CFCrmSwingDomainAskDeleteJPanel(ICFCrmSwingSchema argSchema, ICFCrmDomainObj argFocus) { super();/*from ww w .j a v a2s.c om*/ final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; // Construct the various objects textAreaMessage = new JTextArea("Are you sure you want to delete this Domain?"); actionOk = new ActionOk(); actionCancel = new ActionCancel(); buttonOk = new JButton(actionOk); buttonCancel = new JButton(actionCancel); attrJPanel = argSchema.getDomainFactory().newAttrJPanel(argFocus); scrollPane = new CFHSlaveJScrollPane(attrJPanel); // Lay out the widgets setSize(1024, 480); Dimension min = new Dimension(480, 300); setMinimumSize(min); add(textAreaMessage); textAreaMessage.setBounds(0, 0, 1024, 50); int xparts = (768 - (2 * 125)) / 3; add(buttonOk); buttonOk.setBounds(xparts, 55, 125, 40); add(buttonCancel); buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40); add(scrollPane); scrollPane.setBounds(0, 100, 1024, 480 - 100); }
From source file:net.sourceforge.msscodefactory.cfcrm.v2_0.CFCrmSwing.CFCrmSwingSecAppAskDeleteJPanel.java
public CFCrmSwingSecAppAskDeleteJPanel(ICFCrmSwingSchema argSchema, ICFCrmSecAppObj argFocus) { super();/*from w ww . j av a2 s . c om*/ final String S_ProcName = "construct-schema-focus"; if (argSchema == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "argSchema"); } // argFocus is optional; focus may be set later during execution as // conditions of the runtime change. swingSchema = argSchema; swingFocus = argFocus; // Construct the various objects textAreaMessage = new JTextArea("Are you sure you want to delete this Security Application?"); actionOk = new ActionOk(); actionCancel = new ActionCancel(); buttonOk = new JButton(actionOk); buttonCancel = new JButton(actionCancel); attrJPanel = argSchema.getSecAppFactory().newAttrJPanel(argFocus); scrollPane = new CFHSlaveJScrollPane(attrJPanel); // Lay out the widgets setSize(1024, 480); Dimension min = new Dimension(480, 300); setMinimumSize(min); add(textAreaMessage); textAreaMessage.setBounds(0, 0, 1024, 50); int xparts = (768 - (2 * 125)) / 3; add(buttonOk); buttonOk.setBounds(xparts, 55, 125, 40); add(buttonCancel); buttonCancel.setBounds(xparts + 125 + xparts, 55, 125, 40); add(scrollPane); scrollPane.setBounds(0, 100, 1024, 480 - 100); }