Java Code Examples for javax.swing.JPanel.setLayout()

The following are Jave code examples for showing how to use setLayout() of the javax.swing.JPanel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: VASSAL-src   File: RestrictCommands.java   View Source Code Vote up 6 votes
public Ed(RestrictCommands piece) {

      box = new JPanel();
      box.setLayout(new BoxLayout(box, BoxLayout.Y_AXIS));

      name = new StringConfigurer(null, "Description:  ", piece.name);
      box.add(name.getControls());

      actionOption = new JComboBox();
      actionOption.addItem(HIDE);
      actionOption.addItem(DISABLE);
      actionOption.setSelectedIndex((piece.action.equals(HIDE)) ? 0 : 1);
      Box b = Box.createHorizontalBox();
      b.add(new JLabel("Restriction:  "));
      b.add(actionOption);
      box.add(b);

      propertyMatch = new PropertyExpressionConfigurer(null, "Restrict when properties match:  ", piece.propertyMatch, Decorator.getOutermost(piece));
      box.add(propertyMatch.getControls());

      watchKeys = new NamedKeyStrokeArrayConfigurer(null, "Restrict these Key Commands  ", piece.watchKeys);
      box.add(watchKeys.getControls());

    }
 
Example 2
Project: Community_Tieba-Data-Analyzer   File: EncryptTool.java   View Source Code Vote up 6 votes
public void paintEncrypt(JPanel _panel){
	JButton en = new JButton("Encrypt");
	JButton de = new JButton("Decrypt");
	JPanel panel = new JPanel();
	JPanel panel2 = new JPanel();
	JTextField input = new JTextField(20);
	JTextField output = new JTextField(20);
	JTextField code  = new JTextField(20);
	_panel.add(panel, BorderLayout.CENTER);
	_panel.add(panel2, BorderLayout.SOUTH);
	panel.setLayout(new GridLayout(4,2));
	panel.add(new JLabel("Input File Location :"));
	panel.add(input);
	panel.add(new JLabel("Output File Location :"));
	panel.add(output);
	panel.add(new JLabel("Encryptiong Code :"));
	panel.add(code);
	panel2.add(en);
	panel2.add(de);
	en.addActionListener(event -> encrypt(input.getText(),output.getText(),stringToCode(code.getText())));
	de.addActionListener(event -> decrypt(input.getText(),output.getText(),stringToCode(code.getText())));
}
 
Example 3
Project: Tarski   File: TypeWizard.java   View Source Code Vote up 6 votes
/**
 * Create the frame.
 */
public TypeWizard(final Graph graph, final Object onWhat, final List<Object> list) {
  this.graph = graph;
  this.onWhat = onWhat;

  this.setTitle("Change Atom Type Wizard");
  this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  this.setBounds(100, 100, 450, 300);
  this.getContentPane().setLayout(new BorderLayout(0, 0));

  final JScrollPane scrollPane = new JScrollPane();
  this.getContentPane().add(scrollPane, BorderLayout.CENTER);

  this.list = new JList<Object>();
  this.list.setFont(new Font("Times New Roman", Font.PLAIN, 12));
  this.list.setBorder(new LineBorder(new Color(0, 0, 0)));
  this.list.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
  this.list.setModel(new TypeListModel(list));
  scrollPane.setViewportView(this.list);

  final JPanel buttonPanel = new JPanel();
  this.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
  buttonPanel.setLayout(new BorderLayout(0, 0));

  this.finishButton = new JButton("Finish");
  this.finishButton.setFont(new Font("Times New Roman", Font.PLAIN, 12));
  this.finishButton.setMnemonic('F');
  buttonPanel.add(this.finishButton, BorderLayout.EAST);

  this.finishButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(final ActionEvent arg) {
      TypeWizard.this.performFinish();
      GraphUtil.getInstance().layout();
      TypeWizard.this.dispose();
    }
  });
}
 
Example 4
Project: sstore-soft   File: ProcGui.java   View Source Code Vote up 6 votes
private JPanel createProcParasPane(JPanel parent)
{
    JPanel paneProcParas = new JPanel();
    paneProcParas.setLayout(null);
    paneProcParas.setBorder(BorderFactory.createEtchedBorder());
    int nYStartPaneProcParas = m_paneProbability.getHeight() + GuiConstants.GAP_COMPONENT;
    paneProcParas.setBounds(0, nYStartPaneProcParas, parent.getWidth(), parent.getHeight() - nYStartPaneProcParas);

    LHSListPane scrollParaNames = new LHSListPane(paneProcParas, m_lstProcParaNames);
    paneProcParas.add(scrollParaNames);

    paneProcParas.add(m_paneParaDistribution);
    int nXStartParaDistribution = scrollParaNames.getWidth() + GuiConstants.GAP_COMPONENT;
    int nWidthParaDistribution = paneProcParas.getWidth() - nXStartParaDistribution - GuiConstants.GAP_COMPONENT;
    int nHeightParaDistribution = scrollParaNames.getHeight() - 2 * GuiConstants.GAP_COMPONENT;
    m_paneParaDistribution.setBounds(nXStartParaDistribution, GuiConstants.GAP_COMPONENT, nWidthParaDistribution,
                                     nHeightParaDistribution);

    m_paneParaDistribution.add(s_paneDummy);

    return paneProcParas;
}
 
Example 5
Project: incubator-netbeans   File: CustomizerOptionsPanel.java   View Source Code Vote up 6 votes
/**
 * This method is called from within the constructor to initialize the form. WARNING: Do NOT modify this code. The content of this method is always regenerated by the Form Editor.
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    innerPanel = new JPanel();

    innerPanel.setLayout(new BorderLayout());

    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(innerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addContainerGap())
    );
    layout.setVerticalGroup(
        layout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addContainerGap()
            .addComponent(innerPanel, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addContainerGap())
    );
}
 
Example 6
Project: cuttlefish   File: ShortestPathDemo.java   View Source Code Vote up 6 votes
/**
 *  
 */
private JPanel setUpControls() {
	JPanel jp = new JPanel();
	jp.setBackground(Color.WHITE);
	jp.setLayout(new BoxLayout(jp, BoxLayout.PAGE_AXIS));
	jp.setBorder(BorderFactory.createLineBorder(Color.black, 3));		
	jp.add(
		new JLabel("Select a pair of vertices for which a shortest path will be displayed"));
	JPanel jp2 = new JPanel();
	jp2.add(new JLabel("vertex from", SwingConstants.LEFT));
	jp2.add(getSelectionBox(true));
	jp2.setBackground(Color.white);
	JPanel jp3 = new JPanel();
	jp3.add(new JLabel("vertex to", SwingConstants.LEFT));
	jp3.add(getSelectionBox(false));
	jp3.setBackground(Color.white);
	jp.add( jp2 );
	jp.add( jp3 );
	return jp;
}
 
Example 7
Project: enigma-vk   File: Gui.java   View Source Code Vote up 5 votes
public void onStartOpenJar() {
	m_classesPanel.removeAll();
	JPanel panel = new JPanel();
	panel.setLayout(new FlowLayout());
	panel.add(new JLabel("Loading..."));
	m_classesPanel.add(panel);
	redraw();
}
 
Example 8
Project: rapidminer   File: ParameterTupelCellEditor.java   View Source Code Vote up 5 votes
private void constructPanel(String[] values) {
	// constructing editors
	editors = new PropertyValueCellEditor[types.length];
	for (int i = 0; i < types.length; i++) {
		editors[i] = PropertyPanel.instantiateValueCellEditor(types[i], operator);
	}

	// building panel
	panel = new JPanel();
	panel.setFocusable(true);
	panel.setLayout(new GridLayout(1, editors.length));
	for (int i = 0; i < types.length; i++) {
		Component editorComponent = editors[i].getTableCellEditorComponent(null, values[i], false, 0, 0);

		if (editorComponent instanceof JComboBox && ((JComboBox) editorComponent).isEditable()) {
			if (((JComboBox) editorComponent).isEditable()) {
				ComboBoxEditor editor = ((JComboBox) editorComponent).getEditor();
				if (editor instanceof BasicComboBoxEditor) {
					editor.getEditorComponent().addFocusListener(focusListener);
				}
			} else {
				editorComponent.addFocusListener(focusListener);
			}
		} else if (editorComponent instanceof JPanel) {
			JPanel editorPanel = (JPanel) editorComponent;
			Component[] components = editorPanel.getComponents();
			for (Component comp : components) {
				comp.addFocusListener(focusListener);
			}
		} else {

			editorComponent.addFocusListener(focusListener);
		}
		panel.add(editorComponent);
		panel.addFocusListener(focusListener);
	}
}
 
Example 9
Project: QN-ACTR-Release   File: JabaWizard.java   View Source Code Vote up 5 votes
/**
 * @return the button panel
 */
@Override
protected JComponent makeButtons() {
	help = new HoverHelp();
	helpLabel = help.getHelpLabel();

	helpLabel.setBorder(BorderFactory.createEtchedBorder());
	//helpLabel.setHorizontalAlignment(SwingConstants.CENTER);

	ACTION_FINISH.putValue(Action.NAME, "Solve");
	ACTION_CANCEL.putValue(Action.NAME, "Exit");

	JPanel buttons = new JPanel();

	JButton button_finish = new JButton(ACTION_FINISH);
	help.addHelp(button_finish, "Validates the system and starts the solver");
	JButton button_cancel = new JButton(ACTION_CANCEL);
	help.addHelp(button_cancel, "Exits the wizard discarding all changes");
	JButton button_next = new JButton(ACTION_NEXT);
	help.addHelp(button_next, "Moves on to the next step");
	JButton button_previous = new JButton(ACTION_PREV);
	help.addHelp(button_previous, "Goes back to the previous step");
	JButton button_help = new JButton(ACTION_HELP);
	help.addHelp(button_help, "Displays help for the current panel");
	buttons.add(button_previous);
	buttons.add(button_next);
	buttons.add(button_finish);
	buttons.add(button_cancel);
	buttons.add(button_help);

	JPanel labelbox = new JPanel();
	labelbox.setLayout(new BorderLayout());
	labelbox.add(Box.createVerticalStrut(20), BorderLayout.WEST);
	labelbox.add(helpLabel, BorderLayout.CENTER);

	Box buttonBox = Box.createVerticalBox();
	buttonBox.add(buttons);
	buttonBox.add(labelbox);
	return buttonBox;
}
 
Example 10
Project: JavaGraph   File: ResourceDisplay.java   View Source Code Vote up 5 votes
/**
 * Lazily creates and returns a monolithic panel used as info panel in case there is
 * only an upper panel.
 */
private JPanel getSingleInfoPanel() {
    JPanel result = this.singleInfoPanel;
    if (result == null) {
        this.singleInfoPanel = result = new JPanel();
        result.setLayout(new BorderLayout());
        result.setBorder(null);
    }
    return result;
}
 
Example 11
Project: incubator-netbeans   File: FakeJiraConnector.java   View Source Code Vote up 5 votes
private JPanel createControllerPanel() {
    JPanel controllerPanel = new JPanel();

    JLabel pane = new JLabel();
    pane.setText(NbBundle.getMessage(FakeJiraConnector.class, "MSG_NOT_YET_INSTALLED")); // NOI18N

    JButton downloadButton = new JButton();
    downloadButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            JiraUpdater.getInstance().downloadAndInstall(null);
        }
    });
    
    org.openide.awt.Mnemonics.setLocalizedText(downloadButton, org.openide.util.NbBundle.getMessage(FakeJiraConnector.class, "MissingJiraSupportPanel.downloadButton.text")); // NOI18N

    GroupLayout layout = new GroupLayout(controllerPanel);
    controllerPanel.setLayout(layout);
    layout.setHorizontalGroup(
        layout.createParallelGroup(GroupLayout.Alignment.LEADING)
        .addGroup(layout.createSequentialGroup()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                .addComponent(pane, GroupLayout.PREFERRED_SIZE, 100, Short.MAX_VALUE))
            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
            .addComponent(downloadButton))
    );
    layout.setVerticalGroup(
    layout.createParallelGroup(GroupLayout.Alignment.LEADING)
    .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
        .addComponent(pane)
        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
        .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
            .addComponent(downloadButton))
        .addContainerGap())
    );

    return controllerPanel;
}
 
Example 12
Project: Recaf   File: DefinitionBox.java   View Source Code Vote up 5 votes
public DefinitionBox(MethodNode mn, JList<?> list) {
	super("Definition: " + mn.name);
	setMaximumSize(new Dimension(700, 700));
	setLayout(new GridBagLayout());
	GridBagConstraints c = new GridBagConstraints();
	c.weightx = 1.0;
	c.anchor = GridBagConstraints.WEST;
	c.fill = GridBagConstraints.HORIZONTAL;
	add(c, new JLabel("Name:"), new ActionTextField(mn.name, n -> {
		mn.name = n;
		list.repaint();
	}));
	add(c, new JLabel("Descriptor:"), new ActionTextField(mn.desc, d -> {
		mn.desc = d;
		list.repaint();
	}));
	add(c, new JLabel("Signature:"), new ActionTextField(mn.signature == null ? "" : mn.signature, s -> {
		if (s.isEmpty()) {
			mn.signature = null;
		} else {
			mn.signature = s;
		}
	}));
	add(c, new AccessPanel(mn, null));
	// Exceptions
	JPanel exceptions = new JPanel();
	exceptions.setBorder(BorderFactory.createTitledBorder("Exceptions"));
	exceptions.setLayout(new BoxLayout(exceptions, BoxLayout.Y_AXIS));
	update(exceptions, mn);
	add(c, exceptions);
	setVisible(true);
}
 
Example 13
Project: freecol   File: ResourcesDetailPanel.java   View Source Code Vote up 5 votes
/**
 * {@inheritDoc}
 */
@Override
public void buildDetail(String id, JPanel panel) {
    if (getId().equals(id)) return;

    final Specification spec = getSpecification();
    ResourceType type = spec.getResourceType(id);
    panel.setLayout(new MigLayout("wrap 2", "[]20[]"));

    JLabel name = Utility.localizedHeaderLabel(type, FontLibrary.FontSize.SMALL);
    panel.add(name, "span, align center, wrap 40");

    panel.add(Utility.localizedLabel("colopedia.resource.bonusProduction"));
    JPanel goodsPanel = new JPanel();
    goodsPanel.setOpaque(false);
    List<Modifier> mods = sort(type.getModifiers(),
                               Modifier.ascendingModifierIndexComparator);
    for (Modifier modifier : mods) {
        String text = ModifierFormat.getModifierAsString(modifier);
        if (modifier.hasScope()) {
            String scopes = transform(modifier.getScopes(),
                                      isNotNull(Scope::getType),
                                      s -> Messages.getName(spec.findType(s.getType())),
                                      Collectors.joining(", "));
            if (!scopes.isEmpty()) text += " (" + scopes + ")";
        }

        GoodsType goodsType = spec.getGoodsType(modifier.getId());
        JButton goodsButton = getGoodsButton(goodsType, text);
        goodsPanel.add(goodsButton);
    }
    panel.add(goodsPanel);

    panel.add(Utility.localizedLabel("colopedia.resource.description"),
              "newline 20");
    panel.add(Utility.localizedTextArea(Messages.descriptionKey(type), 30),
              "growx");
}
 
Example 14
Project: hml   File: MyPanel.java   View Source Code Vote up 5 votes
public JPanel createHorizontalPanel(boolean threeD) 
{
	JPanel p = new JPanel();
	p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
	p.setAlignmentY(TOP_ALIGNMENT);
	p.setAlignmentX(LEFT_ALIGNMENT);
	if(threeD) 
	{
		p.setBorder(loweredBorder);
	}
	return p;
}
 
Example 15
Project: routerapp   File: SpecialGraphWindow.java   View Source Code Vote up 4 votes
/**
 * Creates an instance of this class.
 */
public SpecialGraphWindow () {
	setTitle("Create special graph");
	setBounds(50,50,700,500);
	wkPreview = new GraphWorkspace(new GTCGraph(),false);
	
	typeOptions = PluginController.getInstance().getFactories();
	layoutOptions = PluginController.getInstance().getLayouts(null,wkPreview);
	 // Create Center, South, and West and South
	JPanel centerPanel = new JPanel();
	centerPanel.setLayout(new BoxLayout(centerPanel,BoxLayout.X_AXIS));
	JPanel southPanel  = new JPanel(new BorderLayout());
	JPanel westPanel   = new JPanel(new BorderLayout());
	
	// Create and set properties panel
	propertiesPanel = new JPanel();
	propertiesPanel.setLayout(new BoxLayout(propertiesPanel,BoxLayout.Y_AXIS));
	propertiesPanel.setBorder(BorderFactory.createTitledBorder("Properties"));

	// Create ComboBox wirh Graph Factory options
	bType        = new JComboBox(typeOptions);
	bType.setAction(COMBO_GRAPH_TYPE_ACTION);
       buildPropertiesMembersInterface(bType);
	
	// Create and set a Graph Type panel and add a ComboBox type
	JPanel graphTypePanel = new JPanel();
	graphTypePanel.setLayout(new BoxLayout(graphTypePanel,BoxLayout.Y_AXIS));
	graphTypePanel.setBorder(BorderFactory.createTitledBorder("Graph Type"));
	graphTypePanel.add(bType);
	
	// Create ComboBox wirh Graph Factory options
	bLayout        = new JComboBox(layoutOptions);
	bLayout.setAction(COMBO_GRAPH_LAYOUT_ACTION);
	
	// Create and set a Graph Layout panel and add a ComboBox layout
	JPanel graphLayoutPanel = new JPanel();
	graphLayoutPanel.setLayout(new BoxLayout(graphLayoutPanel,BoxLayout.Y_AXIS));
	graphLayoutPanel.setBorder(BorderFactory.createTitledBorder("Graph Layout"));
	graphLayoutPanel.add(bLayout);
	
	// Create a combos` panel
	JPanel comboPanel = new JPanel(new BorderLayout());
	comboPanel.add(graphTypePanel,"North");
	comboPanel.add(graphLayoutPanel,"South");
	
	// Add graph type panel and properties panel in West Panel
	westPanel.add(comboPanel,"North");
	westPanel.add(propertiesPanel,"Center");
	
	// Add preview workspace in Center Panel
	centerPanel.add(wkPreview);
	centerPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
	
	// Create buttons and buttons panel
	JPanel buttonsPanel = new JPanel(new FlowLayout());
	buttonsPanel.add(new JButton(PREVIEW_ACTION));
	buttonsPanel.add(new JButton(RESTORE_DEFAULT_ACTION));
	buttonsPanel.add(new JButton(OK_ACTION));
	buttonsPanel.add(new JButton(CANCEL_ACTION));

	// Add buttons panel in South Panel
	southPanel.add(buttonsPanel,BorderLayout.EAST);
	
	// Add panels in Main Panel (SpecialGraphWindow Content Panel)
	this.getContentPane().setLayout(new BorderLayout());
	this.getContentPane().add(southPanel,BorderLayout.SOUTH);
	this.getContentPane().add(westPanel,BorderLayout.WEST);
	this.getContentPane().add(centerPanel,BorderLayout.CENTER);
	
}
 
Example 16
Project: incubator-netbeans   File: DataViewUI.java   View Source Code Vote up 4 votes
@Override
public void actionPerformed(ActionEvent e) {
    JButton button = (JButton) e.getSource();
    JCheckBox firstEntry = null;
    JPopupMenu popupMenu = new JPopupMenu();

    JPanel menuPanel = new JPanel();
    menuPanel.setFocusCycleRoot(true);
    popupMenu.add(menuPanel);
    menuPanel.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.BASELINE_LEADING;
    constraints.weightx = 1;
    constraints.gridx = 0;
    
    Set<Integer> visibleColumns = dataPanel.getVisibleColumns();
    DataViewTableUIModel dvtm = dataPanel.getModel();
    
    for(int i = 0; i < dvtm.getColumnCount(); i++) {
        JCheckBox columnEntry = new JCheckBox(dvtm.getColumnName(i));
        columnEntry.setActionCommand(Integer.toString(i));
        columnEntry.setSelected(visibleColumns.contains(i));
        columnEntry.addActionListener(columnVisibilityToggler);
        constraints.gridy += 1;
        menuPanel.add(columnEntry, constraints);
        if(firstEntry == null) {
            firstEntry = columnEntry;
        }
    }
    
    constraints.gridy += 1;
    menuPanel.add(new JSeparator(), constraints);
    
    JCheckBox checkboxItem = new JCheckBox("Fit column width");
    checkboxItem.setSelected(dataPanel.getAutoResizeMode() != JTable.AUTO_RESIZE_OFF);
    checkboxItem.addActionListener(fitColumnWidthToggler);
    
    constraints.gridy += 1;
    menuPanel.add(checkboxItem, constraints);
    
    popupMenu.show(button, 0, button.getHeight());
    if(firstEntry == null) {
        checkboxItem.requestFocus();
    } else {
        firstEntry.requestFocus();
    }
}
 
Example 17
Project: Library-app   File: NuevoPrestamo.java   View Source Code Vote up 4 votes
private void initComponents() {
	
	setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	setBounds(100, 100, 439, 337);
	contentPane = new JPanel();
	contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
	setContentPane(contentPane);
	contentPane.setLayout(null);
	
	txtUsuario = new JTextField();
	txtUsuario.setFont(new Font("Tahoma", Font.BOLD, 11));
	txtUsuario.setEditable(false);
	txtUsuario.setBounds(16, 36, 314, 23);
	contentPane.add(txtUsuario);
	txtUsuario.setColumns(10);
	
	JLabel lblUsuario = new JLabel("Usuario");
	lblUsuario.setBounds(16, 21, 61, 14);
	contentPane.add(lblUsuario);
	
	txtCodigo = new JTextField();
	txtCodigo.setFont(new Font("Tahoma", Font.BOLD, 11));
	txtCodigo.setEditable(false);
	txtCodigo.setBounds(16, 146, 314, 23);
	contentPane.add(txtCodigo);
	txtCodigo.setColumns(10);
	
	lblCodigo = new JLabel("Codigo ");
	lblCodigo.setBounds(16, 128, 126, 14);
	contentPane.add(lblCodigo);	
	
	lblfecha_prestDePrestamo = new JLabel("Fecha de pr\u00E9stamo");
	lblfecha_prestDePrestamo.setBounds(16, 193, 148, 14);
	contentPane.add(lblfecha_prestDePrestamo);
	
	btnBuscarCodigo = new JButton("...");
	btnBuscarCodigo.setBounds(346, 146, 61, 23);
	contentPane.add(btnBuscarCodigo);
	btnBuscarCodigo.setEnabled(false);
	btnBuscarCodigo.addActionListener(this);
	
	btnBuscarUsuario = new JButton("...");
	btnBuscarUsuario.setBounds(346, 35, 61, 23);
	contentPane.add(btnBuscarUsuario);
	btnBuscarUsuario.addActionListener(this);
	
	tipo = new Choice();
	tipo.setBounds(16, 91, 115, 20);
	tipo.add("Seleccione");
	tipo.add("Libro");
	tipo.add("Revista");
	tipo.add("CDROM");
	tipo.add("Articulo");
	tipo.setEnabled(false);
	tipo.addItemListener(this);
	contentPane.add(tipo);
	
	lblTipo = new JLabel("Tipo");
	lblTipo.setBounds(16, 71, 46, 14);
	contentPane.add(lblTipo);
	
	addWindowListener(this);
	setVisible(true);
	setLocationRelativeTo(null);
}
 
Example 18
Project: incubator-netbeans   File: SearchField.java   View Source Code Vote up 4 votes
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    panel = new JPanel();
    leftIcon = new JLabel();
    txtSearch = new SearchTextField();
    txtSearch.addFocusListener(new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent e) {
            if (e.getSource() == txtSearch) {
                // make sure nothing is selected
                int n = txtSearch.getText().length();
                txtSearch.select(n, n);
            }
        }
    });
    separator = new javax.swing.JSeparator();

    setLayout(new java.awt.GridBagLayout());

    panel.setBackground(Utils.getTextBackground());
    panel.setBorder(javax.swing.BorderFactory.createLineBorder(Utils.getComboBorderColor()));
    panel.setLayout(new java.awt.GridBagLayout());

    leftIcon.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/notifications/resources/find.png", true));//NOI18N
    leftIcon.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(1, 2, 1, 1);
    panel.add(leftIcon, gridBagConstraints);

    txtSearch.setBorder(null);
    txtSearch.setMinimumSize(new java.awt.Dimension(100, 18));
    txtSearch.setPreferredSize(new java.awt.Dimension(150, 18));

    separator.setOrientation(javax.swing.SwingConstants.VERTICAL);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.VERTICAL;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(3, 0, 3, 3);
    panel.add(separator, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.CENTER;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 0, 0, 2);
    panel.add(txtSearch, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.weightx = 1.0;
    add(panel, gridBagConstraints);
}
 
Example 19
Project: dracoon-dropzone   File: SettingsDialog.java   View Source Code Vote up 4 votes
private JPanel createHotCorners() {
	// main body
	JPanel main = new JPanel();
	main.setBorder(new EmptyBorder(10, 0, 0, 0));
	main.setLayout(new BoxLayout(main, BoxLayout.Y_AXIS));

	// Create and populate the panel.
	JPanel generalSettingsPanel = new JPanel(new SpringLayout());

	MatteBorder mb = new MatteBorder(1, 0, 0, 0, Color.LIGHT_GRAY);
	TitledBorder tb = new TitledBorder(mb, I18n.get("settings.hotcornertitle"), TitledBorder.LEFT,
			TitledBorder.DEFAULT_POSITION);
	generalSettingsPanel.setBorder(tb);

	JLabel cornerLabel = new JLabel(I18n.get("settings.hotcorner"), JLabel.TRAILING);
	generalSettingsPanel.add(cornerLabel);
	hotCornerBox = new JComboBox<>();
	cornerLabel.setLabelFor(hotCornerBox);
	generalSettingsPanel.add(hotCornerBox);
	DefaultComboBoxModel<ScreenPosition> cornerBoxModel = new DefaultComboBoxModel<ScreenPosition>(
			(ScreenPosition[]) Util.getScreenPositions());
	hotCornerBox.setModel(cornerBoxModel);

	JLabel userLabel = new JLabel(I18n.get("settings.hotcornerscreen"), JLabel.TRAILING);
	generalSettingsPanel.add(userLabel);
	screenBox = new JComboBox<>();

	DefaultComboBoxModel<ScreenModel> screenBoxModel = new DefaultComboBoxModel<ScreenModel>(
			(ScreenModel[]) Util.getScreens());
	screenBox.setModel(screenBoxModel);
	generalSettingsPanel.add(screenBox);
	

	JLabel darkIconLabel = new JLabel(I18n.get("settings.darkicon"), JLabel.TRAILING);
	generalSettingsPanel.add(darkIconLabel);
	darkIconInput = new JCheckBox();
	darkIconInput.setSelected(false);
	darkIconLabel.setLabelFor(darkIconInput);
	generalSettingsPanel.add(darkIconInput);

	

	// Lay out the panel.
	SwingUtil.makeCompactGrid(generalSettingsPanel, 3, 2, // rows, cols
			6, 6, // initX, initY
			6, 6); // xPad, yPad

	main.add(generalSettingsPanel);
	return main;
}
 
Example 20
Project: Reinickendorf_SER316   File: TaigaCredentialsWizardStep.java   View Source Code Vote up 4 votes
/**
 * Create the panel.
 */
public TaigaCredentialsWizardStep() {
	setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
	
	JLabel instructionsLabel = new JLabel("Enter your Taiga credentials below:");
	instructionsLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
	add(instructionsLabel);
	
	JPanel panel = new JPanel();
	add(panel);
	GridBagLayout gbl_panel = new GridBagLayout();
	gbl_panel.columnWidths = new int[]{63, 18, 0};
	gbl_panel.rowHeights = new int[]{14, 20, 20, 0};
	gbl_panel.columnWeights = new double[]{0.0, 1.0, Double.MIN_VALUE};
	gbl_panel.rowWeights = new double[]{0.0, 0.0, 0.0, Double.MIN_VALUE};
	panel.setLayout(gbl_panel);
	
	JLabel label = new JLabel("Username:");
	GridBagConstraints gbc_label = new GridBagConstraints();
	gbc_label.insets = new Insets(0, 0, 5, 5);
	gbc_label.gridx = 0;
	gbc_label.gridy = 0;
	panel.add(label, gbc_label);
	
	usernameField = new JTextField();
	GridBagConstraints gbc_usernameField = new GridBagConstraints();
	gbc_usernameField.fill = GridBagConstraints.HORIZONTAL;
	gbc_usernameField.insets = new Insets(0, 0, 5, 0);
	gbc_usernameField.gridx = 1;
	gbc_usernameField.gridy = 0;
	panel.add(usernameField, gbc_usernameField);
	usernameField.setColumns(10);
	
	JLabel label_1 = new JLabel("Password:");
	GridBagConstraints gbc_label_1 = new GridBagConstraints();
	gbc_label_1.insets = new Insets(0, 0, 5, 5);
	gbc_label_1.gridx = 0;
	gbc_label_1.gridy = 1;
	panel.add(label_1, gbc_label_1);
	
	passwordField = new JPasswordField();
	GridBagConstraints gbc_passwordField = new GridBagConstraints();
	gbc_passwordField.fill = GridBagConstraints.HORIZONTAL;
	gbc_passwordField.insets = new Insets(0, 0, 5, 0);
	gbc_passwordField.gridx = 1;
	gbc_passwordField.gridy = 1;
	panel.add(passwordField, gbc_passwordField);
}