Java Code Examples for javax.swing.JTextField#setColumns()

The following examples show how to use javax.swing.JTextField#setColumns() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: OpERP   File: CategoryDetailsPane.java    License: MIT License 6 votes vote down vote up
public CategoryDetailsPane() {
	dialog.setTitle("Category Details");
	pane = new JPanel();
	pane.setLayout(new MigLayout("", "[][grow]", "[][][][]"));

	JLabel lblCategoryId = new JLabel("Category ID");
	pane.add(lblCategoryId, "cell 0 0,alignx trailing");

	categoryIdField = new JTextField();
	categoryIdField.setEditable(false);
	pane.add(categoryIdField, "cell 1 0,growx");
	categoryIdField.setColumns(30);

	JLabel lblCategoryName = new JLabel("Category Name");
	pane.add(lblCategoryName, "cell 0 1,alignx trailing");

	categoryNameField = new JTextField();
	categoryNameField.setEditable(false);
	pane.add(categoryNameField, "cell 1 1,growx");
	categoryNameField.setColumns(30);

}
 
Example 2
/**
 * Create the component.
 */
public DirectoryComponent() {

  super(new BorderLayout());

  // Create text field.
  txtDirectory = new JTextField();
  txtDirectory.setColumns(TEXT_FIELD_COLUMNS);
  txtDirectory.setFont(SMALL_FONT);

  // Chooser button.
  final JButton btnFileBrowser = new JButton("...");
  btnFileBrowser.addActionListener(this);

  add(txtDirectory, BorderLayout.CENTER);
  add(btnFileBrowser, BorderLayout.EAST);
}
 
Example 3
/**
 * Creates the main frame for <code>this</code> sample.
 */
public TextFlipSelectOnEscape() {
    super("Text flip select on ESC");

    this.setLayout(new BorderLayout());

    final JTextField jtf = new JTextField("sample text");
    jtf.setColumns(20);

    JPanel main = new JPanel(new FlowLayout(FlowLayout.CENTER));
    this.add(main, BorderLayout.CENTER);
    main.add(jtf);

    JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    final JCheckBox hasSelectOnFocus = new JCheckBox("Has \"flip select on ESC\" behaviour");
    hasSelectOnFocus.addActionListener((ActionEvent e) -> SubstanceCortex.ComponentScope
            .setFlipTextSelectionOnEscape(jtf, hasSelectOnFocus.isSelected()));

    controls.add(hasSelectOnFocus);
    this.add(controls, BorderLayout.SOUTH);

    this.setSize(400, 200);
    this.setLocationRelativeTo(null);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
 
Example 4
Source Project: netbeans   File: UIUtil.java    License: Apache License 2.0 6 votes vote down vote up
@Messages("LBL_IconInfo=Selected icon [size]:")
private static JPanel getAccesoryPanel(final JTextField iconInfo) {
    iconInfo.setColumns(15);
    iconInfo.setEditable(false);
    
    JPanel accessoryPanel = new JPanel();
    JPanel inner = new JPanel();
    JLabel iconInfoLabel = new JLabel();
    accessoryPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 6, 0));
    
    inner.setLayout(new GridLayout(2, 1, 0, 6));
    
    iconInfoLabel.setLabelFor(iconInfo);
    Mnemonics.setLocalizedText(iconInfoLabel, LBL_IconInfo());
    inner.add(iconInfoLabel);
    
    inner.add(iconInfo);
    
    accessoryPanel.add(inner);
    return accessoryPanel;
}
 
Example 5
Source Project: Ardulink-2   File: SignalButton.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Create the panel.
 */
public SignalButton() {
	setLayout(new BorderLayout(0, 0));
	
	signalButton = new JButton("Send");
	signalButton.addActionListener(new ActionListener() {
		@Override
		public void actionPerformed(ActionEvent e) {
			link.sendCustomMessage(getId(), getValue());
		}
	});
	add(signalButton);
	
	valuePanel = new JPanel();
	add(valuePanel, BorderLayout.NORTH);
	
	valueLabel = new JLabel("Value:");
	valuePanel.add(valueLabel);
	
	textField = new JTextField();
	valuePanel.add(textField);
	textField.setColumns(10);
	textField.setMinimumSize(getPreferredSize());

}
 
Example 6
private void initComponents() {
  nameField = new JTextField(10);
  portField = new IntTextField(0, Integer.MAX_VALUE);
  portField.setColumns(7);
  passwordField = new JPasswordField();
  passwordField.setColumns(10);
  comment = new JTextField();
  comment.setColumns(20);
}
 
Example 7
Source Project: Swing9patch   File: Demo.java    License: Apache License 2.0 5 votes vote down vote up
private void initGUI()
{
	// init components
	txtPhotoframeDialogWidth = new JTextField();
	txtPhotoframeDialogHeight = new JTextField();
	txtPhotoframeDialogWidth.setText("530");
	txtPhotoframeDialogHeight.setText("450");
	txtPhotoframeDialogWidth.setColumns(10);
	txtPhotoframeDialogHeight.setColumns(10);
	
	btnShowInFrame = new JButton("Show in new frame...");
	btnShowInFrame.setUI(new BEButtonUI().setNormalColor(BEButtonUI.NormalColor.blue));
	btnShowInFrame.setForeground(Color.white);
	btnHideTheFrame = new JButton("Hide the frame");
	btnHideTheFrame.setEnabled(false);
	
	panePhotoframe = createPhotoframe();
	panePhotoframe.add(
			new JLabel(new ImageIcon(org.jb2011.swing9patch.photoframe.Demo.class.getResource("imgs/girl.png")))
			, BorderLayout.CENTER);
	
	// init layout
	JPanel paneBtn = new JPanel(new FlowLayout(FlowLayout.CENTER));
	paneBtn.setBorder(BorderFactory.createEmptyBorder(12,0,0,0));
	paneBtn.add(new JLabel("Frame width:"));
	paneBtn.add(txtPhotoframeDialogWidth);
	paneBtn.add(new JLabel("Frame height:"));
	paneBtn.add(txtPhotoframeDialogHeight);
	paneBtn.add(btnShowInFrame);
	paneBtn.add(btnHideTheFrame);
	
	this.setBorder(BorderFactory.createEmptyBorder(12,20,10,20));
	this.add(panePhotoframe, BorderLayout.CENTER);
	this.add(paneBtn, BorderLayout.SOUTH);
	
	// drag panePhotoframe to move its parent window
	DragToMove.apply(new Component[]{panePhotoframe});
}
 
Example 8
/**
 * Initializes the Swing components of this dialog.
 */
private void initialize() {
  cbxWriteStateColumns = new JCheckBox( getResources().getString( "csvexportdialog.write-state-columns" ) ); //$NON-NLS-1$
  cbxColumnNamesAsFirstRow = new JCheckBox( getResources().getString( "cvsexportdialog.export.columnnames" ) ); //$NON-NLS-1$

  getFormValidator().registerButton( cbxColumnNamesAsFirstRow );
  cbxEnableReportHeader = new JCheckBox( getResources().getString( "csvexportdialog.enable-report-header" ) ); //$NON-NLS-1$
  cbxEnableReportFooter = new JCheckBox( getResources().getString( "csvexportdialog.enable-report-footer" ) ); //$NON-NLS-1$
  cbxEnableItemband = new JCheckBox( getResources().getString( "csvexportdialog.enable-itemband" ) ); //$NON-NLS-1$
  cbxEnableGroupHeader = new JCheckBox( getResources().getString( "csvexportdialog.enable-group-header" ) ); //$NON-NLS-1$
  cbxEnableGroupFooter = new JCheckBox( getResources().getString( "csvexportdialog.enable-group-footer" ) ); //$NON-NLS-1$

  getFormValidator().registerButton( cbxEnableGroupFooter );
  getFormValidator().registerButton( cbxEnableGroupHeader );
  getFormValidator().registerButton( cbxEnableItemband );
  getFormValidator().registerButton( cbxEnableReportFooter );
  getFormValidator().registerButton( cbxEnableReportHeader );

  txFilename = new JTextField();
  txFilename.setColumns( 30 );
  encodingModel = EncodingComboBoxModel.createDefaultModel( Locale.getDefault() );
  encodingModel.sort();
  cbEncoding = new JComboBox( encodingModel );

  final JPanel exportPane = createExportPane();

  final JTabbedPane tabbedPane = new JTabbedPane();
  tabbedPane.add( getResources().getString( "csvexportdialog.export-settings" ), exportPane ); //$NON-NLS-1$
  tabbedPane.add( getResources().getString( "csvexportdialog.parameters" ), getParametersPanel() ); //$NON-NLS-1$
  final Configuration config = ClassicEngineBoot.getInstance().getGlobalConfig();
  if ( "true"
      .equals( config
          .getConfigProperty( "org.pentaho.reporting.engine.classic.core.modules.gui.csv.data.AdvancedSettingsAvailable" ) ) ) {
    tabbedPane.add( getResources().getString( "csvexportdialog.advanced-settings" ), createAdvancedOptionsPanel() ); //$NON-NLS-1$
  }
  setContentPane( createContentPane( tabbedPane ) );

  getFormValidator().registerTextField( txFilename );
  getFormValidator().registerComboBox( cbEncoding );
}
 
Example 9
public IntRangeComponent() {

    setBorder(BorderFactory.createEmptyBorder(0, 9, 0, 0));

    minTxtField = new JTextField();
    minTxtField.setColumns(8);

    maxTxtField = new JTextField();
    maxTxtField.setColumns(8);

    add(minTxtField, 0, 0, 1, 1, 1, 0, GridBagConstraints.HORIZONTAL);
    add(new JLabel(" - "), 1, 0, 1, 1, 0, 0);
    add(maxTxtField, 2, 0, 1, 1, 1, 0, GridBagConstraints.HORIZONTAL);
  }
 
Example 10
/**
 * Creates the main frame for <code>this</code> sample.
 */
public HasLockIcon() {
    super("Has lock icon");

    this.setLayout(new BorderLayout());

    final JTextField jtf = new JTextField("sample text");
    jtf.setEditable(false);
    jtf.setColumns(20);

    JPanel main = new JPanel(new FlowLayout(FlowLayout.CENTER));
    this.add(main, BorderLayout.CENTER);
    main.add(jtf);

    JPanel controls = new JPanel(new FlowLayout(FlowLayout.RIGHT));

    final JCheckBox hasLockIcon = new JCheckBox("Has lock icon");
    hasLockIcon.addActionListener((ActionEvent e) -> SubstanceCortex.ComponentScope
            .setLockIconVisible(jtf, hasLockIcon.isSelected()));

    controls.add(hasLockIcon);
    this.add(controls, BorderLayout.SOUTH);

    this.setSize(400, 200);
    this.setLocationRelativeTo(null);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
 
Example 11
Source Project: OpERP   File: WarehouseDetailsPane.java    License: MIT License 5 votes vote down vote up
public WarehouseDetailsPane() {
	pane = new JPanel();
	pane.setLayout(new MigLayout("", "[][grow,center]", "[][][][grow]"));

	JLabel lblWarehouseId = new JLabel("Warehouse Id");
	pane.add(lblWarehouseId, "cell 0 0,alignx trailing");

	warehouseIdField = new JTextField();
	warehouseIdField.setColumns(10);
	warehouseIdField.setEditable(false);
	pane.add(warehouseIdField, "cell 1 0,growx");

	JLabel lblWarehouseName = new JLabel("Warehouse Name");
	pane.add(lblWarehouseName, "cell 0 1,alignx trailing");

	warehouseNameField = new JTextField();
	pane.add(warehouseNameField, "cell 1 1,growx");
	warehouseNameField.setEditable(false);
	warehouseNameField.setColumns(10);

	lblItemsInThis = new JLabel("Items In this Warehouse");
	pane.add(lblItemsInThis, "cell 1 2");

	table = new JTable(tableModel);
	final JScrollPane scrollPane = new JScrollPane(table,
			JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
			JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
	scrollPane.setPreferredSize(new Dimension(456, 200));
	pane.add(scrollPane, "cell 1 3,grow");

}
 
Example 12
/**
 * Create the dialog.
 */
public SizeSelectDialog() {
  setBounds(100, 100, 198, 161);
  getContentPane().setLayout(new BorderLayout());
  contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
  getContentPane().add(contentPanel, BorderLayout.CENTER);
  contentPanel.setLayout(new MigLayout("", "[][]", "[][][]"));
  {
    JLabel lblWidth = new JLabel("width");
    contentPanel.add(lblWidth, "cell 0 0,alignx trailing");
  }
  {
    txtWidth = new JTextField();
    txtWidth.setText("400");
    contentPanel.add(txtWidth, "cell 1 0,growx");
    txtWidth.setColumns(10);
  }
  {
    JLabel lblHeight = new JLabel("height");
    contentPanel.add(lblHeight, "cell 0 1,alignx trailing");
  }
  {
    txtHeight = new JTextField();
    txtHeight.setText("300");
    contentPanel.add(txtHeight, "cell 1 1,growx");
    txtHeight.setColumns(10);
  }
  {
    lblWrongInput = new JLabel("wrong input");
    lblWrongInput.setFont(new Font("Tahoma", Font.BOLD, 13));
    lblWrongInput.setForeground(new Color(220, 20, 60));
    lblWrongInput.setVisible(false);
    contentPanel.add(lblWrongInput, "cell 0 2 2 1");
  }
  {
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
    getContentPane().add(buttonPane, BorderLayout.SOUTH);
    {
      JButton okButton = new JButton("OK");
      okButton.addActionListener(e -> checkResultsAndFinish());
      buttonPane.add(okButton);
      getRootPane().setDefaultButton(okButton);
    }
    {
      JButton cancelButton = new JButton("Cancel");
      cancelButton.addActionListener(e -> setVisible(false));
      buttonPane.add(cancelButton);
    }
  }
  setModalityType(ModalityType.APPLICATION_MODAL);
  setVisible(true);
  pack();
}
 
Example 13
/**
 * Create the dialog.
 */
public SizeSelectDialog() {
  setBounds(100, 100, 198, 161);
  getContentPane().setLayout(new BorderLayout());
  contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
  getContentPane().add(contentPanel, BorderLayout.CENTER);
  contentPanel.setLayout(new MigLayout("", "[][]", "[][][]"));
  {
    JLabel lblWidth = new JLabel("width");
    contentPanel.add(lblWidth, "cell 0 0,alignx trailing");
  }
  {
    txtWidth = new JTextField();
    txtWidth.setText("400");
    contentPanel.add(txtWidth, "cell 1 0,growx");
    txtWidth.setColumns(10);
  }
  {
    JLabel lblHeight = new JLabel("height");
    contentPanel.add(lblHeight, "cell 0 1,alignx trailing");
  }
  {
    txtHeight = new JTextField();
    txtHeight.setText("300");
    contentPanel.add(txtHeight, "cell 1 1,growx");
    txtHeight.setColumns(10);
  }
  {
    lblWrongInput = new JLabel("wrong input");
    lblWrongInput.setFont(new Font("Tahoma", Font.BOLD, 13));
    lblWrongInput.setForeground(new Color(220, 20, 60));
    lblWrongInput.setVisible(false);
    contentPanel.add(lblWrongInput, "cell 0 2 2 1");
  }
  {
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
    getContentPane().add(buttonPane, BorderLayout.SOUTH);
    {
      JButton okButton = new JButton("OK");
      okButton.addActionListener(e -> checkResultsAndFinish());
      buttonPane.add(okButton);
      getRootPane().setDefaultButton(okButton);
    }
    {
      JButton cancelButton = new JButton("Cancel");
      cancelButton.addActionListener(e -> setVisible(false));
      buttonPane.add(cancelButton);
    }
  }
  setModalityType(ModalityType.APPLICATION_MODAL);
  setVisible(true);
  pack();
}
 
Example 14
private void initDisplayColumnsTab() {
	bColumnsChanged = false;
	jpDisplayColumns = new JPanel();
	jlDisplayColumns = new JLabel(res.getString("DPreferences.jlDisplayColumns.text"));

	bEnableEntryName = kstColumns.getEnableEntryName();
	jcbEnableEntryName = new JCheckBox(res.getString("DPreferences.jcbEnableEntryName.text"), bEnableEntryName);
	// fix for problem that without entry name a lot of things do not work
	jcbEnableEntryName.setSelected(true);
	jcbEnableEntryName.setEnabled(false);

	bEnableAlgorithm = kstColumns.getEnableAlgorithm();
	jcbEnableAlgorithm = new JCheckBox(res.getString("DPreferences.jcbEnableAlgorithm.text"), bEnableAlgorithm);

	bEnableKeySize = kstColumns.getEnableKeySize();
	jcbEnableKeySize = new JCheckBox(res.getString("DPreferences.jcbEnableKeySize.text"), bEnableKeySize);
	jcbEnableKeySize.setSelected(bEnableKeySize);

	bEnableCurve = kstColumns.getEnableCurve();
	jcbEnableCurve = new JCheckBox(res.getString("DPreferences.jcbEnableCurve.text"), bEnableCurve);
	jcbEnableCurve.setSelected(bEnableCurve);

	bEnableCertificateExpiry = kstColumns.getEnableCertificateExpiry();
	jcbEnableCertificateExpiry = new JCheckBox(res.getString("DPreferences.jcbEnableCertificateExpiry.text"),
			bEnableCertificateExpiry);
	jcbEnableCertificateExpiry.setSelected(bEnableCertificateExpiry);

	bEnableLastModified = kstColumns.getEnableLastModified();
	jcbEnableLastModified = new JCheckBox(res.getString("DPreferences.jcbEnableLastModified.text"),
			bEnableLastModified);
	jcbEnableLastModified.setSelected(bEnableLastModified);

	bEnableSKI = kstColumns.getEnableSKI();
	jcbEnableSKI = new JCheckBox(res.getString("DPreferences.jcbEnableSKI.text"), bEnableSKI);
	jcbEnableSKI.setSelected(bEnableSKI);

	bEnableAKI = kstColumns.getEnableAKI();
	jcbEnableAKI = new JCheckBox(res.getString("DPreferences.jcbEnableAKI.text"), bEnableAKI);
	jcbEnableAKI.setSelected(bEnableAKI);

	bEnableIssuerDN = kstColumns.getEnableIssuerDN();
	jcbEnableIssuerDN = new JCheckBox(res.getString("DPreferences.jcbEnableIssuerDN.text"), bEnableIssuerDN);
	jcbEnableIssuerDN.setSelected(bEnableIssuerDN);

	bEnableSubjectDN = kstColumns.getEnableSubjectDN();
	jcbEnableSubjectDN = new JCheckBox(res.getString("DPreferences.jcbEnableSubjectDN.text"), bEnableSubjectDN);
	jcbEnableSubjectDN.setSelected(bEnableSubjectDN);

	bEnableIssuerCN = kstColumns.getEnableIssuerCN();
	jcbEnableIssuerCN = new JCheckBox(res.getString("DPreferences.jcbEnableIssuerCN.text"), bEnableIssuerCN);
	jcbEnableIssuerCN.setSelected(bEnableIssuerCN);

	bEnableSubjectCN = kstColumns.getEnableSubjectCN();
	jcbEnableSubjectCN = new JCheckBox(res.getString("DPreferences.jcbEnableSubjectCN.text"), bEnableSubjectCN);
	jcbEnableSubjectCN.setSelected(bEnableSubjectCN);

	bEnableIssuerO = kstColumns.getEnableIssuerO();
	jcbEnableIssuerO = new JCheckBox(res.getString("DPreferences.jcbEnableIssuerO.text"), bEnableIssuerO);
	jcbEnableIssuerO.setSelected(bEnableIssuerO);

	bEnableSubjectO = kstColumns.getEnableSubjectO();
	jcbEnableSubjectO = new JCheckBox(res.getString("DPreferences.jcbEnableSubjectO.text"), bEnableSubjectO);
	jcbEnableSubjectO.setSelected(bEnableSubjectO);

	jlExpirationWarnDays = new JLabel(res.getString("DPreferences.jlExpiryWarning.text"));
	jtfExpirationWarnDays = new JTextField();
	jtfExpirationWarnDays.setColumns(3);
	jtfExpirationWarnDays.setText(Integer.toString(expiryWarnDays));

	jpDisplayColumns.setLayout(new MigLayout("insets dialog, fill", "[][]", ""));
	jpDisplayColumns.add(jlDisplayColumns, "left, wrap");
	jpDisplayColumns.add(jcbEnableEntryName, "left");
	jpDisplayColumns.add(jcbEnableAlgorithm, "left, wrap");
	jpDisplayColumns.add(jcbEnableKeySize, "left");
	jpDisplayColumns.add(jcbEnableCurve, "left, wrap");
	jpDisplayColumns.add(jcbEnableCertificateExpiry, "left");
	jpDisplayColumns.add(jcbEnableLastModified, "left, wrap");
	jpDisplayColumns.add(jcbEnableSKI, "left");
	jpDisplayColumns.add(jcbEnableAKI, "left, wrap");
	jpDisplayColumns.add(jcbEnableIssuerDN, "left");
	jpDisplayColumns.add(jcbEnableSubjectDN, "left, wrap");
	jpDisplayColumns.add(jcbEnableIssuerCN, "left");
	jpDisplayColumns.add(jcbEnableSubjectCN, "left, wrap");
	jpDisplayColumns.add(jcbEnableIssuerO, "left");
	jpDisplayColumns.add(jcbEnableSubjectO, "left, wrap");
	jpDisplayColumns.add(jlExpirationWarnDays, "left, spanx, split");
	jpDisplayColumns.add(jtfExpirationWarnDays, "wrap");
}
 
Example 15
/**
 *
 */
private void initGUI() {
  this.setLayout( new GridBagLayout() );
  final GridBagConstraints constraints = new GridBagConstraints();

  // Add the width label
  constraints.gridx = 0;
  constraints.gridy = 0;
  constraints.anchor = GridBagConstraints.EAST;
  this.add( new JLabel( "Width:" ), constraints );

  // Add the spinner with its model
  constraints.gridx = 1;
  constraints.gridy = 0;
  constraints.anchor = GridBagConstraints.WEST;
  final JTextField strokeWidthField = new JTextField();
  strokeWidthField.getDocument().addDocumentListener( new WidthUpdateHandler( strokeWidthField ) );
  strokeWidthField.setText( String.valueOf( width ) );
  strokeWidthField.setColumns( 6 );
  this.add( strokeWidthField, constraints );

  // Add the dash Label
  constraints.gridx = 0;
  constraints.gridy = 1;
  constraints.anchor = GridBagConstraints.CENTER;
  this.add( new JLabel( "Dashes:" ), constraints );

  // Add the dash comboBox
  constraints.gridx = 1;
  constraints.gridy = 1;

  final JComboBox dashComboBox =
      new JComboBox( new Object[] { BorderStyle.SOLID, BorderStyle.DASHED, BorderStyle.DOTTED,
        BorderStyle.DOT_DASH, BorderStyle.DOT_DOT_DASH } );
  dashComboBox.setRenderer( new BorderStyleRenderer() );
  dashComboBox.setSelectedItem( borderStyle );
  dashComboBox.addActionListener( new DashSelectionHandler( dashComboBox ) );
  this.add( dashComboBox, constraints );

  // Add the sample box
  constraints.gridx = 0;
  constraints.gridy = 2;
  constraints.gridwidth = GridBagConstraints.REMAINDER;
  constraints.fill = GridBagConstraints.HORIZONTAL;

  this.add( samplePanel, constraints );
}
 
Example 16
Source Project: snowblossom   File: SendPanel.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void setupPanel()
{

   GridBagConstraints c = new GridBagConstraints();
   c.weightx = 0.0;
   c.weighty= 0.0;
   c.gridheight = 1;
   c.anchor = GridBagConstraints.WEST;


   c.gridwidth = 1;
   panel.add(new JLabel("Wallet to send from:"), c);
   c.gridwidth = GridBagConstraints.REMAINDER;

   wallet_select_box = new WalletComboBox(ice_leaf);
   panel.add(wallet_select_box, c);

   c.gridwidth = 1;
   panel.add(new JLabel("Destination address:"), c);
   c.gridwidth = GridBagConstraints.REMAINDER;

   dest_field = new JTextField();
   dest_field.setColumns(65);
   panel.add(dest_field, c);


   c.gridwidth = 1;
   panel.add(new JLabel("Send amount (or 'all'):"), c);
   c.gridwidth = GridBagConstraints.REMAINDER;

   send_amount_field = new JTextField();
   send_amount_field.setColumns(15);
   panel.add(send_amount_field, c);

   send_bar = new JProgressBar(0, SEND_DELAY);
   panel.add(send_bar, c);

   send_button = new JButton("Send");
   panel.add(send_button, c);

   send_button.addActionListener(new SendButtonListner());


 }
 
Example 17
public ReplaceStringsOptions() {
    this.setIconImages(Resources.iconList);
    setSize(new Dimension(250, 176));
    setResizable(false);
    setTitle("Replace Strings");
    getContentPane().setLayout(null);

    JButton btnNewButton = new JButton("Start Replacing");
    btnNewButton.setBounds(6, 115, 232, 23);
    getContentPane().add(btnNewButton);

    JLabel lblNewLabel = new JLabel("Original LDC:");
    lblNewLabel.setBounds(6, 40, 67, 14);
    getContentPane().add(lblNewLabel);

    textField = new JTextField();
    textField.setBounds(80, 37, 158, 20);
    getContentPane().add(textField);
    textField.setColumns(10);

    JLabel lblNewLabel_1 = new JLabel("New LDC:");
    lblNewLabel_1.setBounds(6, 65, 77, 14);
    getContentPane().add(lblNewLabel_1);

    textField_1 = new JTextField();
    textField_1.setColumns(10);
    textField_1.setBounds(80, 62, 158, 20);
    getContentPane().add(textField_1);

    JLabel lblNewLabel_2 = new JLabel("Class:");
    lblNewLabel_2.setBounds(6, 90, 46, 14);
    getContentPane().add(lblNewLabel_2);

    textField_2 = new JTextField();
    textField_2.setToolTipText("* will search all classes");
    textField_2.setText("*");
    textField_2.setBounds(80, 87, 158, 20);
    getContentPane().add(textField_2);
    textField_2.setColumns(10);

    final JCheckBox chckbxNewCheckBox = new JCheckBox(
            "Replace All Contains");
    chckbxNewCheckBox
            .setToolTipText("If it's unticked, it will check if the string equals, if its ticked it will check if it contains, then replace the original LDC part of the string.");
    chckbxNewCheckBox.setBounds(6, 7, 232, 23);
    getContentPane().add(chckbxNewCheckBox);
    btnNewButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            PluginManager.runPlugin(new ReplaceStrings(textField.getText(),
                    textField_1.getText(), textField_2.getText(),
                    chckbxNewCheckBox.isSelected()));
            dispose();
        }
    });
    this.setLocationRelativeTo(null);
}
 
Example 18
Source Project: Despector   File: Viewer.java    License: MIT License 4 votes vote down vote up
public static void main(String[] args) {

        LibraryConfiguration.parallel = false;
        LibraryConfiguration.quiet = false;
        LibraryConfiguration.emit_block_debug = true;

        tabs.put(TabType.SOURCE, new TabData(TabType.SOURCE));
        tabs.put(TabType.BYTECODE, new TabData(TabType.BYTECODE));
        tabs.put(TabType.DECOMPILED, new TabData(TabType.DECOMPILED));
        tabs.put(TabType.GRAPH_0, new TabData(TabType.GRAPH_0));
        tabs.put(TabType.GRAPH_1, new TabData(TabType.GRAPH_1));
        tabs.put(TabType.GRAPH_2, new TabData(TabType.GRAPH_2));

        JFrame frame = new JFrame("Despector");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setBounds(50, 50, 1600, 900);
        JPanel contentPane = new JPanel();
        contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
        contentPane.setLayout(new BorderLayout(0, 0));
        frame.setContentPane(contentPane);

        JPanel panel = new JPanel();
        contentPane.add(panel, BorderLayout.NORTH);

        file_name_field = new JTextField();
        panel.add(file_name_field);
        file_name_field.setColumns(100);
        file_name_field.setText("net.minecraft.");

        JButton loadBtn = new JButton("Load");
        panel.add(loadBtn);
        loadBtn.addActionListener(Viewer::onLoad);

        JSplitPane splitPane = new JSplitPane();
        splitPane.setDividerLocation(800);
        contentPane.add(splitPane, BorderLayout.CENTER);

        JTabbedPane leftPane = new JTabbedPane(JTabbedPane.TOP);
        splitPane.setLeftComponent(leftPane);

        leftPane.addTab("Source", null, new JScrollPane(tabs.get(TabType.SOURCE).left), null);
        leftPane.addTab("Bytecode", null, new JScrollPane(tabs.get(TabType.BYTECODE).left), null);
        leftPane.addTab("Decompiled", null, new JScrollPane(tabs.get(TabType.DECOMPILED).left), null);
        leftPane.addTab("Graph 0", null, new JScrollPane(tabs.get(TabType.GRAPH_0).left), null);
        leftPane.addTab("Graph 1", null, new JScrollPane(tabs.get(TabType.GRAPH_1).left), null);
        leftPane.addTab("Graph 2", null, new JScrollPane(tabs.get(TabType.GRAPH_2).left), null);

        JTabbedPane rightPane = new JTabbedPane(JTabbedPane.TOP);
        splitPane.setRightComponent(rightPane);

        rightPane.addTab("Source", null, new JScrollPane(tabs.get(TabType.SOURCE).right), null);
        rightPane.addTab("Bytecode", null, new JScrollPane(tabs.get(TabType.BYTECODE).right), null);
        rightPane.addTab("Decompiled", null, new JScrollPane(tabs.get(TabType.DECOMPILED).right), null);
        rightPane.addTab("Graph 0", null, new JScrollPane(tabs.get(TabType.GRAPH_0).right), null);
        rightPane.addTab("Graph 1", null, new JScrollPane(tabs.get(TabType.GRAPH_1).right), null);
        rightPane.addTab("Graph 2", null, new JScrollPane(tabs.get(TabType.GRAPH_2).right), null);

        frame.setVisible(true);
    }
 
Example 19
/**
	 * Create the panel.
	 */
	public SerialConnectionPanel() {

		// decomment this to use simple byte protocol
//		link = Link.getInstance("serialConnection");
//		if(link == null) {
//			Set<String> protocolNames = ProtocolHandler.getInstalledProtocolImplementationNames();
//			if(!protocolNames.contains(SimpleBinaryProtocol.NAME)) {
//				ProtocolHandler.installProtocolImplementation(new SimpleBinaryProtocol());
//			}
//			link = Link.createInstance("serialConnection", SimpleBinaryProtocol.NAME);
//		}
		
		Dimension dimension = new Dimension(275, 80);
		setPreferredSize(dimension);
		setMinimumSize(dimension);
		setLayout(null);
		
		JLabel connectionPortLabel = new JLabel("Connection Port:");
		connectionPortLabel.setHorizontalAlignment(SwingConstants.RIGHT);
		connectionPortLabel.setBounds(6, 16, 91, 16);
		add(connectionPortLabel);
		
		connectionPortComboBox = new JComboBox();
		connectionPortComboBox.setBounds(108, 10, 122, 28);
		add(connectionPortComboBox);
		
		lblBaudRate = new JLabel("Baud Rate:");
		lblBaudRate.setHorizontalAlignment(SwingConstants.RIGHT);
		lblBaudRate.setBounds(6, 44, 91, 16);
		add(lblBaudRate);
		
		baudRateTextField = new JTextField();
		baudRateTextField.setText(String.valueOf(Link.DEFAULT_BAUDRATE));
		baudRateTextField.setColumns(10);
		baudRateTextField.setBounds(108, 38, 122, 28);
		add(baudRateTextField);
		
		discoverButton = new JButton("");
		discoverButton.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				List<String> portList = link.getPortList();
//				portList = new ArrayList<String>(); // Mock code...
//				portList.add("COM19");
//				portList.add("COM20");
				if(portList != null && !portList.isEmpty()) {
					connectionPortComboBox
							.setModel(new DefaultComboBoxModel(portList
									.toArray(new String[portList.size()])));
				} else {
					connectionPortComboBox.removeAllItems();
				}
			}
		});
		discoverButton.setIcon(new ImageIcon(SerialConnectionPanel.class.getResource("icons/search_icon.png")));
		discoverButton.setToolTipText("Discover");
		discoverButton.setBounds(235, 8, 32, 32);
		add(discoverButton);
		

	}
 
Example 20
/**
 * Create the frame.
 */
public Saludo() {
	super("Saludo", true, true, true, true);
	setBounds(100, 100, 226, 112);
	
	JLabel lblNombre = new JLabel("Nombre:");
	
	txtNombre = new JTextField();
	txtNombre.setColumns(10);
	
	JButton btnSaludar = new JButton("Saludar");
	btnSaludar.addMouseListener(new MouseAdapter() {
		@Override
		public void mouseClicked(MouseEvent e) {
			saludar();
		}
	});
	GroupLayout groupLayout = new GroupLayout(getContentPane());
	groupLayout.setHorizontalGroup(
		groupLayout.createParallelGroup(Alignment.LEADING)
			.addGroup(groupLayout.createSequentialGroup()
				.addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
					.addGroup(groupLayout.createSequentialGroup()
						.addContainerGap()
						.addComponent(lblNombre)
						.addPreferredGap(ComponentPlacement.RELATED)
						.addComponent(txtNombre, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
					.addGroup(groupLayout.createSequentialGroup()
						.addGap(53)
						.addComponent(btnSaludar)))
				.addContainerGap(242, Short.MAX_VALUE))
	);
	groupLayout.setVerticalGroup(
		groupLayout.createParallelGroup(Alignment.LEADING)
			.addGroup(groupLayout.createSequentialGroup()
				.addContainerGap()
				.addGroup(groupLayout.createParallelGroup(Alignment.BASELINE)
					.addComponent(lblNombre)
					.addComponent(txtNombre, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
				.addPreferredGap(ComponentPlacement.RELATED)
				.addComponent(btnSaludar)
				.addContainerGap(206, Short.MAX_VALUE))
	);
	getContentPane().setLayout(groupLayout);

}