List of usage examples for javax.swing SwingConstants CENTER
int CENTER
To view the source code for javax.swing SwingConstants CENTER.
Click Source Link
From source file:edu.virginia.speclab.juxta.author.view.export.WebServiceExportDialog.java
/** * Create a UI panel to show export progress *///from w w w. j av a2s.co m private void createStatusPane() { this.statusPanel = new JPanel(); this.statusPanel.setBackground(Color.white); this.statusPanel.setLayout(new BorderLayout(5, 5)); this.statusPanel.setBorder(BorderFactory.createEmptyBorder(15, 0, 0, 0)); JPanel content = new JPanel(); content.setBackground(Color.white); content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS)); content.add(Box.createVerticalStrut(30)); JLabel l = new JLabel("Status", SwingConstants.CENTER); l.setAlignmentX(CENTER_ALIGNMENT); l.setFont(JuxtaUserInterfaceStyle.LARGE_FONT); content.add(l); content.add(Box.createVerticalStrut(10)); this.statusLabel = new JLabel("", SwingConstants.CENTER); this.statusLabel.setAlignmentX(CENTER_ALIGNMENT); this.setFont(JuxtaUserInterfaceStyle.NORMAL_FONT); content.add(this.statusLabel); this.statusPanel.add(content, BorderLayout.CENTER); JPanel p = new JPanel(); p.setBackground(Color.white); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(Box.createHorizontalGlue()); this.workAnimation = new JLabel(); this.workAnimation.setIcon(JuxtaUserInterfaceStyle.WORKING_ANIMATION); p.add(this.workAnimation); p.add(Box.createHorizontalGlue()); this.statusPanel.add(p, BorderLayout.NORTH); }
From source file:edu.ku.brc.specify.utilapps.ERDTable.java
/** * @param p//from w ww. j a va 2s . c o m * @param r * @param font * @param y * @param all * @return */ public JComponent build(final PanelBuilder p, final DBRelationshipInfo r, final Font font, final int y, boolean all) { String type = r.getType().toString().toLowerCase(); type = getResourceString(type); CellConstraints cc = new CellConstraints(); p.add(ERDVisualizer.mkLabel(font, StringUtils.substringAfterLast(r.getClassName(), "."), SwingConstants.LEFT), cc.xy(1, y)); p.add(ERDVisualizer.mkLabel(font, StringUtils.capitalize(r.getTitle()), SwingConstants.LEFT), cc.xy(3, y)); JComponent comp = ERDVisualizer.mkLabel(font, type, SwingConstants.CENTER); p.add(comp, cc.xy(5, y)); if (all) { comp = ERDVisualizer.mkLabel(font, r.isRequired() ? yesStr : "", SwingConstants.CENTER); p.add(comp, cc.xy(7, y)); } return comp; }
From source file:App.java
/** * Initialize the contents of the frame. *///from w w w. j av a 2s. c o m private void initialize() { frame = new JFrame(); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(1000, 750); frame.getContentPane().setLayout(null); FileNameExtensionFilter filter = new FileNameExtensionFilter("Image files", "jpg", "jpeg", "png"); fc = new JFileChooser(); fc.setFileFilter(filter); frame.getContentPane().add(fc); stepOne = new JLabel(""); stepOne.setToolTipText("here comes something"); stepOne.setIcon(new ImageIcon("img/stepOne.png")); stepOne.setBounds(266, -4, 67, 49); frame.getContentPane().add(stepOne); btnBrowse = new JButton("Browse"); btnBrowse.setBounds(66, 6, 117, 29); frame.getContentPane().add(btnBrowse); btnTurnWebcamOn = new JButton("Take a picture with webcam"); btnTurnWebcamOn.setBounds(66, 34, 212, 29); frame.getContentPane().add(btnTurnWebcamOn); JButton btnTakePictureWithWebcam = new JButton("Take a picture"); btnTakePictureWithWebcam.setBounds(430, 324, 117, 29); frame.getContentPane().add(btnTakePictureWithWebcam); btnTakePictureWithWebcam.setVisible(false); JButton btnCancel = new JButton("Cancel"); btnCancel.setBounds(542, 324, 117, 29); frame.getContentPane().add(btnCancel); btnCancel.setVisible(false); JButton btnSaveImage = new JButton("Save image"); btnSaveImage.setBounds(497, 357, 117, 29); frame.getContentPane().add(btnSaveImage); btnSaveImage.setVisible(false); urlField = new JTextField(); urlField.setBounds(66, 67, 220, 26); frame.getContentPane().add(urlField); urlField.setColumns(10); originalImageLabel = new JLabel(); originalImageLabel.setHorizontalAlignment(SwingConstants.CENTER); originalImageLabel.setBounds(33, 98, 300, 300); frame.getContentPane().add(originalImageLabel); stepTwo = new JLabel(""); stepTwo.setToolTipText("here comes something else"); stepTwo.setIcon(new ImageIcon("img/stepTwo.png")); stepTwo.setBounds(266, 413, 67, 49); frame.getContentPane().add(stepTwo); btnAnalyse = new JButton("Analyse image"); btnAnalyse.setBounds(68, 423, 196, 29); frame.getContentPane().add(btnAnalyse); tagsField = new JTextArea(); tagsField.setBounds(23, 479, 102, 89); tagsField.setLineWrap(true); tagsField.setWrapStyleWord(true); frame.getContentPane().add(tagsField); tagsField.setColumns(10); lblTags = new JLabel("Tags:"); lblTags.setBounds(46, 451, 61, 16); frame.getContentPane().add(lblTags); descriptionField = new JTextArea(); descriptionField.setLineWrap(true); descriptionField.setWrapStyleWord(true); descriptionField.setBounds(137, 479, 187, 89); frame.getContentPane().add(descriptionField); descriptionField.setColumns(10); lblDescription = new JLabel("Description:"); lblDescription.setBounds(163, 451, 77, 16); frame.getContentPane().add(lblDescription); stepThree = new JLabel(""); stepThree.setToolTipText("here comes something different"); stepThree.setIcon(new ImageIcon("img/stepThree.png")); stepThree.setBounds(266, 685, 67, 49); frame.getContentPane().add(stepThree); JLabel lblImageType = new JLabel("Image type"); lblImageType.setBounds(23, 580, 102, 16); frame.getContentPane().add(lblImageType); String[] imageTypes = { "unspecified", "AnimategGif", "Clipart", "Line", "Photo" }; JComboBox imageTypeBox = new JComboBox(imageTypes); imageTypeBox.setBounds(137, 580, 187, 23); frame.getContentPane().add(imageTypeBox); JLabel lblSizeType = new JLabel("Size"); lblSizeType.setBounds(23, 608, 102, 16); frame.getContentPane().add(lblSizeType); String[] sizeTypes = { "unspecified", "Small", "Medium", "Large", "Wallpaper" }; JComboBox sizeBox = new JComboBox(sizeTypes); sizeBox.setBounds(137, 608, 187, 23); frame.getContentPane().add(sizeBox); JLabel lblLicenseType = new JLabel("License"); lblLicenseType.setBounds(23, 636, 102, 16); frame.getContentPane().add(lblLicenseType); String[] licenseTypes = { "unspecified", "Public", "Share", "ShareCommercially", "Modify" }; JComboBox licenseBox = new JComboBox(licenseTypes); licenseBox.setBounds(137, 636, 187, 23); frame.getContentPane().add(licenseBox); JLabel lblSafeSearchType = new JLabel("Safe search"); lblSafeSearchType.setBounds(23, 664, 102, 16); frame.getContentPane().add(lblSafeSearchType); String[] safeSearchTypes = { "Strict", "Moderate", "Off" }; JComboBox safeSearchBox = new JComboBox(safeSearchTypes); safeSearchBox.setBounds(137, 664, 187, 23); frame.getContentPane().add(safeSearchBox); btnSearchForSimilar = new JButton("Search for similar images"); btnSearchForSimilar.setVisible(true); btnSearchForSimilar.setBounds(66, 695, 189, 29); frame.getContentPane().add(btnSearchForSimilar); // label to try urls to display images, not shown on the main frame labelTryLinks = new JLabel(); labelTryLinks.setBounds(0, 0, 100, 100); foundImagesLabel1 = new JLabel(); foundImagesLabel1.setHorizontalAlignment(SwingConstants.CENTER); foundImagesLabel1.setBounds(400, 49, 250, 250); frame.getContentPane().add(foundImagesLabel1); foundImagesLabel2 = new JLabel(); foundImagesLabel2.setHorizontalAlignment(SwingConstants.CENTER); foundImagesLabel2.setBounds(400, 313, 250, 250); frame.getContentPane().add(foundImagesLabel2); foundImagesLabel3 = new JLabel(); foundImagesLabel3.setHorizontalAlignment(SwingConstants.CENTER); foundImagesLabel3.setBounds(673, 49, 250, 250); frame.getContentPane().add(foundImagesLabel3); foundImagesLabel4 = new JLabel(); foundImagesLabel4.setHorizontalAlignment(SwingConstants.CENTER); foundImagesLabel4.setBounds(673, 313, 250, 250); frame.getContentPane().add(foundImagesLabel4); progressBar = new JProgressBar(); progressBar.setIndeterminate(true); progressBar.setStringPainted(true); progressBar.setBounds(440, 602, 440, 29); Border border = BorderFactory .createTitledBorder("We are checking every image, pixel by pixel, it may take a while..."); progressBar.setBorder(border); frame.getContentPane().add(progressBar); progressBar.setVisible(false); btnHelp = new JButton(""); btnHelp.setBorderPainted(false); ImageIcon btnIcon = new ImageIcon("img/helpRed.png"); btnHelp.setIcon(btnIcon); btnHelp.setBounds(917, 4, 77, 59); frame.getContentPane().add(btnHelp); // all action listeners btnBrowse.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (fc.showOpenDialog(frame) == JFileChooser.APPROVE_OPTION) { openFilechooser(); } } }); btnTurnWebcamOn.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setAllFoundImagesLabelsAndPreviewsToNull(); btnTakePictureWithWebcam.setVisible(true); btnCancel.setVisible(true); turnCameraOn(); } }); btnTakePictureWithWebcam.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnSaveImage.setVisible(true); // take a photo with web camera imageWebcam = webcam.getImage(); originalImage = imageWebcam; // to mirror the image we create a temporary file, flip it // horizontally and then delete // get user's name to store file in the user directory String user = System.getProperty("user.home"); String fileName = user + "/webCamPhoto.jpg"; File newFile = new File(fileName); try { ImageIO.write(originalImage, "jpg", newFile); } catch (IOException e1) { e1.printStackTrace(); } try { originalImage = (BufferedImage) ImageIO.read(newFile); } catch (IOException e1) { e1.printStackTrace(); } newFile.delete(); originalImage = mirrorImage(originalImage); icon = scaleBufferedImage(originalImage, originalImageLabel); originalImageLabel.setIcon(icon); } }); btnSaveImage.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { if (fc.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) { try { file = fc.getSelectedFile(); File output = new File(file.toString()); // check if image already exists if (output.exists()) { int response = JOptionPane.showConfirmDialog(null, // "Do you want to replace the existing file?", // "Confirm", JOptionPane.YES_NO_OPTION, // JOptionPane.QUESTION_MESSAGE); if (response != JOptionPane.YES_OPTION) { return; } } ImageIO.write(toBufferedImage(originalImage), "jpg", output); System.out.println("Your image has been saved in the folder " + file.getPath()); } catch (IOException e1) { e1.printStackTrace(); } } } }); btnCancel.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { btnTakePictureWithWebcam.setVisible(false); btnCancel.setVisible(false); btnSaveImage.setVisible(false); webcam.close(); panel.setVisible(false); } }); urlField.addKeyListener(new KeyAdapter() { @Override public void keyReleased(KeyEvent e) { if (urlField.getText().length() > 0) { String linkNew = urlField.getText(); getImageFromHttp(linkNew, originalImageLabel); originalImage = imageResponses; } } }); btnAnalyse.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { Token computerVisionToken = new Token(); String computerVisionTokenFileName = "APIToken.txt"; try { computerVisionImageToken = computerVisionToken.getApiToken(computerVisionTokenFileName); try { analyse(); } catch (NullPointerException e1) { // if user clicks on "analyze" button without uploading // image or posts a broken link JOptionPane.showMessageDialog(null, "Please choose an image"); e1.printStackTrace(); } } catch (NullPointerException e1) { e1.printStackTrace(); } } }); btnSearchForSimilar.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // clear labels in case there were results of previous search setAllFoundImagesLabelsAndPreviewsToNull(); System.out.println("=========================================="); System.out.println("new search"); System.out.println("=========================================="); Token bingImageToken = new Token(); String bingImageTokenFileName = "SearchApiToken.txt"; bingToken = bingImageToken.getApiToken(bingImageTokenFileName); // in case user edited description or tags, update it and // replace new line character, spaces and breaks with %20 text = descriptionField.getText().replace(" ", "%20").replace("\r", "%20").replace("\n", "%20"); String tagsString = tagsField.getText().replace(" ", "%20").replace("\r", "%20").replace("\n", "%20"); imageTypeString = imageTypeBox.getSelectedItem().toString(); sizeTypeString = sizeBox.getSelectedItem().toString(); licenseTypeString = licenseBox.getSelectedItem().toString(); safeSearchTypeString = safeSearchBox.getSelectedItem().toString(); searchParameters = tagsString + text; System.out.println("search parameters: " + searchParameters); if (searchParameters.length() != 0) { // add new thread for searching, so that progress bar and // searching could run simultaneously Thread t1 = new Thread(new Runnable() { @Override public void run() { progressBar.setVisible(true); searchForSimilarImages(searchParameters, imageTypeString, sizeTypeString, licenseTypeString, safeSearchTypeString); } }); // start searching for similar images in a separate thread t1.start(); } else { JOptionPane.showMessageDialog(null, "Please choose first an image to analyse or insert search parameters"); } } }); foundImagesLabel1.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (foundImagesLabel1.getIcon() != null) { if (fc.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) { saveFileChooser(firstImageUrl); } } } }); foundImagesLabel2.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (foundImagesLabel2.getIcon() != null) { if (fc.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) { saveFileChooser(secondImageUrl); } } } }); foundImagesLabel3.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (foundImagesLabel3.getIcon() != null) { if (fc.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) { saveFileChooser(thirdImageUrl); } } } }); foundImagesLabel4.addMouseListener(new MouseAdapter() { @Override public void mouseReleased(MouseEvent e) { if (foundImagesLabel4.getIcon() != null) { if (fc.showSaveDialog(frame) == JFileChooser.APPROVE_OPTION) { saveFileChooser(fourthImageUrl); } } } }); btnHelp.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { // TODO write help HelpFrame help = new HelpFrame(); } }); }
From source file:edu.ku.brc.specify.config.init.TreeDefSetupPanel.java
/** * @param classType the class of the TreeDef * @param classTitle the already localized title of the actual tree * @param panelName the name of the panel * @param descKey L10N key to label description above the table * @param nextBtn the next button/*from w w w . j a va 2s . c om*/ * @param dbPanel the */ public TreeDefSetupPanel(final Class<?> classType, final String classTitle, final String panelName, final String helpContext, final String descKey, final JButton nextBtn, final JButton prevBtn, final DisciplinePanel disciplinePanel) { super(panelName, helpContext, nextBtn, prevBtn); this.classType = classType; this.classTitle = classTitle; this.disciplinePanel = disciplinePanel; if (classType == TaxonTreeDef.class || classType == GeographyTreeDef.class || classType == StorageTreeDef.class) { model = new TreeDefTableModel(); if (classType != TaxonTreeDef.class) { loadTree(disciplinePanel != null && disciplinePanel.getDisciplineType() != null ? disciplinePanel.getDisciplineType().getDisciplineType() : null); } table = new JTable(model); directionCBX = UIHelper .createComboBox(new String[] { getResourceString("FORWARD"), getResourceString("REVERSE") }); fullnameDisplayTxt = new JEditorPane(); fullnameDisplayTxt.setBackground(Color.WHITE); fullnameDisplayTxt.setOpaque(true); fullnameDisplayTxt.setContentType("text/html"); fullnameDisplayTxt.setEditable(false); table.setRowSelectionAllowed(false); table.setColumnSelectionAllowed(false); //table.setDefaultRenderer(String.class, new BiColorTableCellRenderer(false)); model.addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent e) { updateBtnUI(); } }); JScrollPane spex = new JScrollPane(fullnameDisplayTxt, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); CellConstraints cc = new CellConstraints(); PanelBuilder pb = new PanelBuilder( new FormLayout("p,2px,p,250px,f:p:g", "p,4px,min(p;250px),4px,p,4px,65px,2px,p"), this); JScrollPane sp = createScrollPane(table); sp.getViewport().setBackground(Color.WHITE); String lbl = getLocalizedMessage(descKey, classTitle); pb.add(createLabel(lbl, SwingConstants.CENTER), cc.xyw(1, 1, 4)); pb.add(sp, cc.xyw(1, 3, 5)); pb.add(createI18NFormLabel("DIRECTION"), cc.xy(1, 5)); pb.add(directionCBX, cc.xy(3, 5)); pb.add(createI18NFormLabel("EXAMPLE"), cc.xy(1, 7)); pb.add(spex, cc.xywh(3, 7, 2, 3)); makeTableHeadersCentered(table, true); directionCBX.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateBtnUI(); } }); table.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { updateBtnUI(); int inx = table.getSelectedColumn(); if (inx > -1) { TreeDefRow row = treeDefList.get(table.getSelectedRow()); String msgKey = null; if (row.isRequired() && (inx == 1 || inx == 3)) { msgKey = inx == 1 ? "NO_CHANGE_INCL" : "NO_CHANGE_REQ"; } else if (inx == 4 && !row.isIncluded()) { msgKey = "NO_CHANGE_INFN"; } if (msgKey != null) { final String mk = msgKey; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { showLocalizedMsg(mk); } }); } } } } }); updateBtnUI(); } }
From source file:ch.fork.AdHocRailway.ui.locomotives.configuration.LocomotiveConfig.java
private void initComponents() { nameTextField = BasicComponentFactory .createTextField(presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_NAME)); nameTextField.setColumns(30);/*from w ww .j av a 2s . co m*/ descTextField = BasicComponentFactory .createTextField(presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_DESCRIPTION)); descTextField.setColumns(30); imageChoserPanel = new JPanel(new MigLayout("fill")); imageTextField = BasicComponentFactory .createTextField(presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_IMAGE)); imageTextField.setColumns(30); chooseImageButton = new JButton("Choose..."); chooseImageButton.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { chooseLocoImage(); } }); imageChoserPanel.add(imageTextField, "grow"); imageChoserPanel.add(chooseImageButton); imageLabel = new JLabel(); imageLabel.setHorizontalAlignment(SwingConstants.CENTER); imageLabel.setIcon(LocomotiveImageHelper.getLocomotiveIcon(presentationModel.getBean())); busSpinner = new JSpinner(); busSpinner.setModel(SpinnerAdapterFactory.createNumberAdapter( presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_BUS), 1, // defaultValue 0, // minValue 100, // maxValue 1)); // step address1Spinner = new JSpinner(); address1Spinner.setModel(SpinnerAdapterFactory.createNumberAdapter( presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_ADDRESS1), 1, // defaultValue 0, // minValue 324, // maxValue 1)); // step address2Spinner = new JSpinner(); address2Spinner.setModel(SpinnerAdapterFactory.createNumberAdapter( presentationModel.getBufferedModel(Locomotive.PROPERTYNAME_ADDRESS2), 1, // defaultValue 0, // minValue 324, // maxValue 1)); // step final List<LocomotiveType> locomotiveTypes = Arrays.asList(LocomotiveType.values()); final ValueModel locomotiveTypeModel = presentationModel .getBufferedModel(Locomotive.PROPERTYNAME_LOCOMOTIVE_TYPE); locomotiveTypeComboBox = BasicComponentFactory .createComboBox(new SelectionInList<LocomotiveType>(locomotiveTypes, locomotiveTypeModel)); functions = new ArrayListModel<LocomotiveFunction>(presentationModel.getBean().getFunctions()); functionsTable = new JTable(); functionsModel = new SelectionInList<LocomotiveFunction>(); functionsModel.setList(functions); functionsTable.setModel(new LocomotiveFunctionTableModel(functionsModel)); functionsTable.getColumnModel().getColumn(0).setCellRenderer(new CenterRenderer()); errorPanel = new ErrorPanel(); validate(presentationModel.getBean(), null); presentationModel.getBean().addPropertyChangeListener(this); okButton = new JButton(new ApplyChangesAction()); cancelButton = new JButton(new CancelAction()); }
From source file:com.db4o.sync4o.ui.Db4oSyncSourceConfigPanel.java
private void setupControls() { // Layout and setup UI components... setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS)); add(_namePanel);/*from w w w .j a v a2s .c o m*/ _namePanel.setAlignmentX(Component.LEFT_ALIGNMENT); add(_fieldsPanel); _fieldsPanel.setAlignmentX(Component.LEFT_ALIGNMENT); add(_classConfigsTree); _classConfigsTree.setAlignmentX(Component.LEFT_ALIGNMENT); _classConfigsTree.setPreferredSize(new Dimension(300, 300)); add(_buttonsPanel); _buttonsPanel.setAlignmentX(Component.LEFT_ALIGNMENT); JLabel l; // Admin UI Management Panels use a title // (in a particular "title font") to identify themselves l = new JLabel("Edit Db4oSyncSource Configuration", SwingConstants.CENTER); l.setBorder(new TitledBorder("")); l.setFont(titlePanelFont); _namePanel.add(l); GridBagConstraints labelConstraints = new GridBagConstraints(); labelConstraints.gridwidth = 1; labelConstraints.fill = GridBagConstraints.NONE; labelConstraints.weightx = 0.0; labelConstraints.gridx = 0; labelConstraints.gridy = 0; labelConstraints.anchor = GridBagConstraints.EAST; GridBagConstraints fieldConstraints = new GridBagConstraints(); fieldConstraints.gridwidth = 2; fieldConstraints.fill = GridBagConstraints.HORIZONTAL; fieldConstraints.weightx = 1.0; fieldConstraints.gridx = 1; fieldConstraints.gridy = 0; _fieldsPanel.add(new JLabel("Source URI: "), labelConstraints); _fieldsPanel.add(_sourceUriValue, fieldConstraints); labelConstraints.gridy = GridBagConstraints.RELATIVE; fieldConstraints.gridy = GridBagConstraints.RELATIVE; _fieldsPanel.add(new JLabel("Name: "), labelConstraints); _fieldsPanel.add(_nameValue, fieldConstraints); fieldConstraints.gridwidth = 1; _fieldsPanel.add(new JLabel("db4o File: "), labelConstraints); _fieldsPanel.add(_dbFileValue, fieldConstraints); _dbFileValue.setEditable(false); fieldConstraints.gridwidth = 2; GridBagConstraints buttonConstraints = new GridBagConstraints(); buttonConstraints.gridwidth = 1; buttonConstraints.fill = GridBagConstraints.NONE; buttonConstraints.gridx = 2; buttonConstraints.gridy = 3; _dbFileLocateButton.setText("..."); _fieldsPanel.add(_dbFileLocateButton, buttonConstraints); buttonConstraints.gridwidth = 3; buttonConstraints.fill = GridBagConstraints.NONE; buttonConstraints.gridx = 0; buttonConstraints.gridy = GridBagConstraints.RELATIVE; buttonConstraints.anchor = GridBagConstraints.CENTER; // Ensure all the controls use the Admin UI standard font Component[] components = _fieldsPanel.getComponents(); for (int i = 0; i < components.length; i++) { Component c = components[i]; c.setFont(defaultFont); } _confirmButton.setText("Add"); _buttonsPanel.add(_confirmButton); }
From source file:edu.ku.brc.specify.config.init.secwiz.UserPanel.java
/** * /*from www . j av a 2 s .c om*/ */ protected void createUI() { dbList = new JList(new DefaultListModel()); otherDBList = new JList(new DefaultListModel()); userModel = new UserTableModel(null); userTable = new JTable(userModel); CellConstraints cc = new CellConstraints(); saveBtn = UIHelper.createButton("Save"); mkKeysBtn = UIHelper.createButton("Make Keys"); copyKeyBtn = UIHelper.createButton("Copy Master Key"); sendKeysBtn = UIHelper.createButton("Send Keys"); showKeysBtn = UIHelper.createButton("Show Summary"); printKeysBtn = UIHelper.createButton("Print"); btns = new JButton[] { saveBtn, sendKeysBtn, copyKeyBtn, showKeysBtn, printKeysBtn }; String colDef = UIHelper.createDuplicateJGoodiesDef("p", "8px", btns.length); PanelBuilder btnPB = new PanelBuilder(new FormLayout("f:p:g," + colDef, "p")); int x = 2; for (JButton b : btns) { btnPB.add(b, cc.xy(x, 1)); x += 2; } saveBtn.setEnabled(false); copyKeyBtn.setEnabled(false); label = UIHelper.createLabel("", SwingConstants.CENTER); gainAccessBtn = UIHelper.createIconBtn("Unmap", "", null); loseAccessBtn = UIHelper.createIconBtn("Map", "", null); PanelBuilder bpb = new PanelBuilder(new FormLayout("p", "f:p:g,p,8px,p,f:p:g")); bpb.add(gainAccessBtn, cc.xy(1, 2)); bpb.add(loseAccessBtn, cc.xy(1, 4)); PanelBuilder tpb = new PanelBuilder(new FormLayout("f:p:g,10px,p,10px,f:p:g", "p,4px,f:p:g")); tpb.add(UIHelper.createI18NLabel("MSTR_HAS_PERM", SwingConstants.CENTER), cc.xy(1, 1)); tpb.add(otherDBLbl = UIHelper.createI18NLabel("MSTR_HAS_NOPERM", SwingConstants.CENTER), cc.xy(5, 1)); tpb.add(dbScrollPane = UIHelper.createScrollPane(dbList), cc.xy(1, 3)); tpb.add(bpb.getPanel(), cc.xy(3, 3)); tpb.add(odbScrollPane = UIHelper.createScrollPane(otherDBList), cc.xy(5, 3)); PanelBuilder pb = new PanelBuilder(new FormLayout("f:p:g,p", "f:p:g,20px,p,8px,p,4px,f:p:g,4px,p,20px,p"), this); sendKeysBtn.setVisible(false); int y = 1; pb.add(tpb.getPanel(), cc.xyw(1, y, 2)); y += 2; y += 2; pb.add(label, cc.xyw(1, y, 2)); y += 2; pb.add(userScrollPane = UIHelper.createScrollPane(userTable), cc.xyw(1, y, 2)); y += 2; pb.add(btnPB.getPanel(), cc.xy(2, y)); y += 2; pb.addSeparator("", cc.xyw(1, y, 2)); y += 2; dbList.setVisibleRowCount(8); otherDBList.setVisibleRowCount(8); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { Dimension size = userTable.getPreferredScrollableViewportSize(); size.height = 10 * userTable.getRowHeight(); userTable.setPreferredScrollableViewportSize(size); } }); updateBtnUI(false); dbList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { loadData(false); gainAccessBtn.setEnabled(otherDBList.getSelectedIndex() > -1); loseAccessBtn.setEnabled(dbList.getSelectedIndex() > -1); } } }); userTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { doUserSelected(); } } }); saveBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { saveUserData(); } }); sendKeysBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { sendKeys(); } }); mkKeysBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { makeKeys(); } }); copyKeyBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { int inx = userTable.getSelectedRow(); if (inx > -1) { String masterKey = userModel.getUserData().get(inx).getMasterKey(); UIHelper.setTextToClipboard(masterKey); } } }); showKeysBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { displayData(); } }); printKeysBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { printUserData(); } }); gainAccessBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changeMasterAccess(true); } }); loseAccessBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changeMasterAccess(false); } }); otherDBList.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { otherDBName = (String) otherDBList.getSelectedValue(); gainAccessBtn.setEnabled(otherDBList.getSelectedIndex() > -1); loseAccessBtn.setEnabled(dbList.getSelectedIndex() > -1); } } }); }
From source file:com.funambol.LDAP.admin.LDAPSyncSourceConfigPanel.java
/** * Create the panel//from w w w. j a v a 2 s . com * @throws Exception if error occures during creation of the panel */ private void init() { // set layout this.setLayout(null); int startX = 14; int fontHeight = 18; int col1Size = 150; int col2X = startX + col1Size + 6; //170px int col2Size = 350; int col3X = col2X + col2Size + 6; // 550 int col3Size = 90; int chkboxSize = 18; // set properties of label, position and border // referred to the title of the panel titledBorder1 = new TitledBorder(""); panelName.setFont(titlePanelFont); panelName.setText("Edit LDAP SyncSourceContacts"); panelName.setBounds(new Rectangle(startX, 5, 316, 28)); panelName.setAlignmentX(SwingConstants.CENTER); panelName.setBorder(titledBorder1); int baseline = 60; sourceUriLabel.setText("Source URI: "); sourceUriLabel.setToolTipText("Choose a unique word"); sourceUriLabel.setFont(defaultFont); sourceUriLabel.setBounds(new Rectangle(startX, baseline, col1Size, fontHeight)); sourceUriValue.setFont(FONT_ARIAL); sourceUriValue.setBounds(new Rectangle(col2X, baseline, col2Size, fontHeight)); baseline += 30; nameLabel.setText("Name: "); nameLabel.setToolTipText("Choose a word and set this into your client in order to use this connector"); nameLabel.setFont(defaultFont); nameLabel.setBounds(new Rectangle(startX, baseline, col1Size, fontHeight)); nameValue.setFont(FONT_ARIAL); nameValue.setBounds(new Rectangle(col2X, baseline, col2Size, fontHeight)); baseline += 30; typeLabel.setText("Type: "); typeLabel.setToolTipText("Only VCARD are supported, SIF is deprecated"); typeLabel.setFont(defaultFont); typeLabel.setBounds(new Rectangle(startX, baseline, col1Size, fontHeight)); typeValue.setBounds(new Rectangle(col2X, baseline, col2Size, fontHeight)); baseline += 30; providerUrlLabel.setText("LDAP URI: "); providerUrlLabel.setToolTipText("eg. ldap://ldap.example.com , ldaps://ldap.example.com:390 "); providerUrlLabel.setFont(defaultFont); providerUrlLabel.setBounds(new Rectangle(startX, baseline, col1Size, fontHeight)); providerUrlValue.setFont(FONT_ARIAL); providerUrlValue.setBounds(new Rectangle(col2X, baseline, col2Size, fontHeight)); baseline += 30; ldapBaseLabel.setText("LDAP Base DN: "); ldapBaseLabel.setToolTipText( "This is used to define where to store/read user's data.\nRead install.txt notes to use parameters"); ldapBaseLabel.setFont(defaultFont); ldapBaseLabel.setBounds(new Rectangle(startX, baseline, col1Size, fontHeight)); ldapBaseValue.setFont(FONT_ARIAL); ldapBaseValue.setBounds(new Rectangle(col2X, baseline, col2Size, fontHeight)); baseline += 30; // TODO contactDaoLabel, entryFilterLabel daoNameLabel.setText("DAO Class for converting item to LDAP"); daoNameLabel.setToolTipText("piTypePerson, inetOrgPerson or organizationalPerson"); daoNameLabel.setFont(defaultFont); daoNameLabel.setBounds(new Rectangle(startX, baseline, col1Size, fontHeight)); daoNameValue.setFont(FONT_ARIAL); daoNameValue.setBounds(new Rectangle(col2X, baseline, col2Size, fontHeight)); baseline += 30; entryFilterLabel.setText("Filter user by"); entryFilterLabel .setToolTipText("A valid LDAP search filter, eg: (&(objectclass=inetOrgPerson)(active=1))"); entryFilterLabel.setFont(defaultFont); entryFilterLabel.setBounds(new Rectangle(startX, baseline, col1Size, fontHeight)); entryFilterValue.setFont(FONT_ARIAL); entryFilterValue.setBounds(new Rectangle(col2X, baseline, col2Size, fontHeight)); baseline += 30; ldapUserLabel.setText("LDAP User: "); ldapUserLabel.setToolTipText("LDAP Bind DN (username) to access the LDAP server"); ldapUserLabel.setFont(defaultFont); ldapUserLabel.setBounds(new Rectangle(startX, baseline, col1Size, fontHeight)); ldapUserValue.setFont(FONT_ARIAL); ldapUserValue.setBounds(new Rectangle(col2X, baseline, col2Size, fontHeight)); baseline += 30; ldapPassLabel.setText("LDAP Password: "); ldapPassLabel.setToolTipText("LDAP Bind DN password to access LDAP server"); ldapPassLabel.setFont(defaultFont); ldapPassLabel.setBounds(new Rectangle(startX, baseline, col1Size, fontHeight)); ldapPassValue.setFont(FONT_ARIAL); ldapPassValue.setBounds(new Rectangle(col2X, baseline, col2Size, fontHeight)); // follow referral followReferralLabel.setText("Follow Referral "); followReferralLabel.setToolTipText("Select this checkbox if you want ldap to follow smart-referrals"); followReferralLabel.setFont(defaultFont); followReferralLabel.setBounds(new Rectangle(col3X, 270, col3Size, fontHeight)); followReferralValue.setSelected(false); followReferralValue.setBounds(new Rectangle(col3X, 300, col3Size, fontHeight)); // connection pooling connectionPoolingLabel.setText("Pooling "); connectionPoolingLabel.setToolTipText("Select this checkbox if you want use connection pooling"); connectionPoolingLabel.setFont(defaultFont); connectionPoolingLabel.setBounds(new Rectangle(col3X + col3Size, 270, col3Size, fontHeight)); connectionPoolingValue.setSelected(false); connectionPoolingValue.setBounds(new Rectangle(col3X + col3Size, 300, col3Size, fontHeight)); baseline += 30; dbNameLabel.setText("Funambol DBMS Name: "); dbNameLabel.setToolTipText("Funambol DS table to store metadata. Use fnblcore"); dbNameLabel.setFont(defaultFont); dbNameLabel.setBounds(new Rectangle(startX, baseline, col1Size, fontHeight)); dbNameValue.setFont(FONT_ARIAL); dbNameValue.setBounds(new Rectangle(col2X, baseline, col2Size, fontHeight)); baseline += 30; timeZoneLabel.setFont(defaultFont); timeZoneLabel.setBounds(new Rectangle(startX, baseline, col1Size, fontHeight)); timeZoneValue = new JComboBox(TimeZone.getAvailableIDs()); timeZoneValue.setBounds(new Rectangle(col2X, baseline, col2Size, fontHeight)); // rpolli baseline += 30; ldapServerLabel.setText("LDAP Server Type"); ldapServerLabel.setFont(defaultFont); ldapServerLabel.setBounds(new Rectangle(startX, baseline, col1Size, fontHeight)); ldapServerValue.setBounds(new Rectangle(col2X, baseline, col2Size, fontHeight)); ldapServerValue.setToolTipText("Select compatibility unique ID's per items."); confirmButton.setFont(defaultFont); confirmButton.setText("Add"); confirmButton.setBounds(col2X, 420, 70, 25); confirmButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent event) { try { validateValues(); getValues(); if (getState() == STATE_INSERT) { LDAPSyncSourceConfigPanel.this.actionPerformed(new ActionEvent( LDAPSyncSourceConfigPanel.this, ACTION_EVENT_INSERT, event.getActionCommand())); } else { LDAPSyncSourceConfigPanel.this.actionPerformed(new ActionEvent( LDAPSyncSourceConfigPanel.this, ACTION_EVENT_UPDATE, event.getActionCommand())); } } catch (Exception e) { e.printStackTrace(); notifyError(new AdminException(e.getMessage())); } } }); // add all components to the panel this.add(panelName, null); this.add(nameLabel, null); this.add(nameValue, null); this.add(typeLabel, null); this.add(typeValue, null); this.add(sourceUriLabel, null); this.add(sourceUriValue, null); //rpolli this.add(ldapServerLabel, null); this.add(ldapServerValue, null); this.add(this.daoNameLabel, null); this.add(this.daoNameValue, null); this.add(followReferralLabel, null); this.add(followReferralValue, null); this.add(connectionPoolingLabel, null); this.add(connectionPoolingValue, null); this.add(providerUrlLabel, null); this.add(providerUrlValue, null); // this.add(ldapPortLabel , null); // this.add(ldapPortValue , null); // this.add(isSSLLabel , null); // this.add(isSSLValue , null); this.add(ldapBaseLabel, null); this.add(ldapBaseValue, null); this.add(entryFilterLabel, null); this.add(entryFilterValue, null); this.add(ldapUserLabel, null); this.add(ldapUserValue, null); this.add(ldapPassLabel, null); this.add(ldapPassValue, null); this.add(timeZoneLabel, null); this.add(timeZoneValue, null); this.add(dbNameLabel, null); this.add(dbNameValue, null); this.add(confirmButton, null); }
From source file:drusy.ui.panels.WifiStatePanel.java
private void initComponents() { // JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents // Generated using JFormDesigner Evaluation license - Kevin Renella headerPanel = new JPanel(); label1 = new JLabel(); mainPanel = new JPanel(); //======== this ======== setLayout(new BorderLayout()); //======== headerPanel ======== {//w w w. ja va2s.c om headerPanel.setLayout(new BorderLayout()); //---- label1 ---- label1.setText("This panel shows you the users connected on the Wi-Fi"); label1.setHorizontalAlignment(SwingConstants.CENTER); headerPanel.add(label1, BorderLayout.CENTER); } add(headerPanel, BorderLayout.NORTH); //======== mainPanel ======== { mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS)); } add(mainPanel, BorderLayout.CENTER); // JFormDesigner - End of component initialization //GEN-END:initComponents }
From source file:com.dnsoft.inmobiliaria.controllers.ConsultaCCPropietariosController.java
final void configuraTblPropietarios() { ((DefaultTableCellRenderer) view.tblPropietario.getTableHeader().getDefaultRenderer()) .setHorizontalAlignment(SwingConstants.CENTER); listPropietarios = new ArrayList<>(); tableModelPropietarios = new PropietariosTableModel(listPropietarios); view.tblPropietario.setModel(tableModelPropietarios); view.tblPropietario.setRowHeight(25); view.tblPropietario.getColumn("Activo").setMaxWidth(0); view.tblPropietario.getColumn("Activo").setMinWidth(0); view.tblPropietario.getColumn("Activo").setPreferredWidth(0); view.tblPropietario.getColumn("Activo").setWidth(0); view.tblPropietario.setDefaultRenderer(Object.class, new TableRendererColorActivo(2)); ListSelectionModel listModel = view.tblPropietario.getSelectionModel(); listModel.addListSelectionListener(new ListSelectionListener() { @Override/*w w w. java 2s.c o m*/ public void valueChanged(ListSelectionEvent lse) { if (view.tblPropietario.getSelectedRow() != -1) { view.btnCuenta.setEnabled(true); view.btnPropietario.setEnabled(true); } else { view.btnCuenta.setEnabled(false); view.btnPropietario.setEnabled(false); } } }); view.tblPropietario.addMouseListener(new MouseAdapter() { @Override public void mousePressed(MouseEvent me) { if (me.getClickCount() == 2) { detallesCCPropietario(); } } }); }