List of usage examples for javax.swing BorderFactory createBevelBorder
public static Border createBevelBorder(int type)
From source file:com.t3.client.ui.T3Frame.java
public void showControlPanel(JPanel... panels) { JPanel layoutPanel = new JPanel(new GridBagLayout()); layoutPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); int i = 0;//www. j a va 2 s .co m for (JPanel panel : panels) { GridBagConstraints gbc = new GridBagConstraints(); gbc.gridx = 1; gbc.gridy = i; gbc.weightx = 1; gbc.fill = GridBagConstraints.BOTH; layoutPanel.add(panel, gbc); i++; } layoutPanel.setSize(layoutPanel.getPreferredSize()); zoneRendererPanel.add(layoutPanel, PositionalLayout.Position.NE); zoneRendererPanel.setComponentZOrder(layoutPanel, 0); zoneRendererPanel.revalidate(); zoneRendererPanel.repaint(); visibleControlPanel = layoutPanel; }
From source file:org.jets3t.apps.uploader.Uploader.java
/** * Initialise the application's File drop targets for drag and drop copying of local files * to S3./*w ww . j a va 2 s . c o m*/ * * @param dropTargetComponents * the components files can be dropped on to transfer them to S3 */ private void initDropTarget(Component[] dropTargetComponents) { DropTargetListener dropTargetListener = new DropTargetListener() { private Border originalBorder = appContentPanel.getBorder(); private Border dragOverBorder = BorderFactory.createBevelBorder(1); private boolean checkValidDrag(DropTargetDragEvent dtde) { if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && (DnDConstants.ACTION_COPY == dtde.getDropAction() || DnDConstants.ACTION_MOVE == dtde.getDropAction())) { dtde.acceptDrag(dtde.getDropAction()); return true; } else { dtde.rejectDrag(); return false; } } public void dragEnter(DropTargetDragEvent dtde) { if (checkValidDrag(dtde)) { SwingUtilities.invokeLater(new Runnable() { public void run() { appContentPanel.setBorder(dragOverBorder); }; }); } } public void dragOver(DropTargetDragEvent dtde) { checkValidDrag(dtde); } public void dropActionChanged(DropTargetDragEvent dtde) { checkValidDrag(dtde); } public void dragExit(DropTargetEvent dte) { SwingUtilities.invokeLater(new Runnable() { public void run() { appContentPanel.setBorder(originalBorder); }; }); } public void drop(DropTargetDropEvent dtde) { if (dtde.isDataFlavorSupported(DataFlavor.javaFileListFlavor) && (DnDConstants.ACTION_COPY == dtde.getDropAction() || DnDConstants.ACTION_MOVE == dtde.getDropAction())) { dtde.acceptDrop(dtde.getDropAction()); SwingUtilities.invokeLater(new Runnable() { public void run() { appContentPanel.setBorder(originalBorder); }; }); try { final List fileList = (List) dtde.getTransferable() .getTransferData(DataFlavor.javaFileListFlavor); if (fileList != null && fileList.size() > 0) { if (checkProposedUploadFiles(fileList)) { wizardStepForward(); } } } catch (Exception e) { String errorMessage = "Unable to accept dropped item"; log.error(errorMessage, e); ErrorDialog.showDialog(ownerFrame, null, uploaderProperties.getProperties(), errorMessage, e); } } else { dtde.rejectDrop(); } } }; // Attach drop target listener to each target component. for (int i = 0; i < dropTargetComponents.length; i++) { new DropTarget(dropTargetComponents[i], DnDConstants.ACTION_COPY, dropTargetListener, true); } }
From source file:net.rptools.maptool.launcher.MapToolLauncher.java
/** * This method is called from within the constructor to initialize the form * components./* w w w.j a va 2s . co m*/ */ private void initComponents() { // Lee: for aesthetics and Linux won't display window controls on an untitled window. final String version = CopiedFromOtherJars.getVersion(); setTitle(CopiedFromOtherJars.getText("msg.title.mainWindow", version)); //$NON-NLS-1$ if (jbPathText == null) jbPathText = CopiedFromOtherJars.getText("msg.info.setJavaVersion"); //$NON-NLS-1$ if (jbMTJarText == null) jbMTJarText = CopiedFromOtherJars.getText("msg.info.selectMapToolJar"); //$NON-NLS-1$ if (mapToolJarName == null) mapToolJarName = CopiedFromOtherJars.getText("msg.info.selectMapToolJar"); //$NON-NLS-1$ final Container cp = getContentPane(); cp.setLayout(new BorderLayout()); final JPanel basicPanel = buildBasicPanel(); final JPanel langPanel = buildLanguagePanel(); final JPanel advancedPanel = buildAdvancedPanel(); final JPanel tsPanel = buildTroubleshootingPanel(); mtlOptions.addTab(CopiedFromOtherJars.getText("msg.tab.basic"), basicPanel); //$NON-NLS-1$ mtlOptions.addTab(CopiedFromOtherJars.getText("msg.tab.language"), langPanel); //$NON-NLS-1$ mtlOptions.addTab(CopiedFromOtherJars.getText("msg.tab.advanced"), advancedPanel); //$NON-NLS-1$ mtlOptions.addTab(CopiedFromOtherJars.getText("msg.tab.troubleshoot"), tsPanel); //$NON-NLS-1$ cp.add(mtlOptions, BorderLayout.CENTER); cp.add(jtfCommand, BorderLayout.SOUTH); // Lee: user must register MT executable jbLaunch.setEnabled( !mapToolJarName.equalsIgnoreCase(CopiedFromOtherJars.getText("msg.info.selectMapToolJar"))); //$NON-NLS-1$ jbLaunch.setText(CopiedFromOtherJars.getText("msg.info.launchMapTool")); //$NON-NLS-1$ jbLaunch.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent evt) { try { jbLaunchActionPerformed(evt); } catch (final IOException e) { e.printStackTrace(); } } }); jtfCommand.setEditable(false); jtfCommand.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); jtfCommand.setText(CopiedFromOtherJars.getText("msg.info.cmdLineShownHere")); //$NON-NLS-1$ jtfCommand.addFocusListener(new FocusListener() { @Override public void focusGained(FocusEvent arg0) { jtfCommand.selectAll(); } @Override public void focusLost(FocusEvent arg0) { jtfCommand.setCaretPosition(0); } }); jcbKeepOpen.setSelected(false); jcbKeepOpen.setText(CopiedFromOtherJars.getText("msg.info.keepLauncherOpen")); //$NON-NLS-1$ jcbKeepOpen.setToolTipText(CopiedFromOtherJars.getText("msg.tooltip.keepLauncherOpen")); //$NON-NLS-1$ final JPanel lowerPanel = new JPanel(); lowerPanel.setLayout(new GridLayout(3, 1)); lowerPanel.setBorder(new LineBorder(Color.BLACK)); lowerPanel.add(jbLaunch); lowerPanel.add(jcbKeepOpen); lowerPanel.add(jtfCommand); cp.add(lowerPanel, BorderLayout.SOUTH); mtlOptions.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { final JTabbedPane source = (JTabbedPane) e.getSource(); final String tabName = source.getTitleAt(source.getSelectedIndex()); if (jbLaunch.isEnabled()) { jbLaunch.requestFocusInWindow(); } else { if (tabName.equals(CopiedFromOtherJars.getText("msg.tab.basic"))) { //$NON-NLS-1$ jbMTJar.requestFocusInWindow(); } else if (tabName.equals(CopiedFromOtherJars.getText("msg.tab.language"))) { //$NON-NLS-1$ // This should work as long as there's at least one language in the list. langGroup.getElements().nextElement().requestFocusInWindow(); } else if (tabName.equals(CopiedFromOtherJars.getText("msg.tab.advanced"))) { //$NON-NLS-1$ jcbConsole.requestFocusInWindow(); jtfArgs.setText(extraArgs); } else { jcbEnableAssertions.requestFocusInWindow(); } } } }); Dimension d = new Dimension(advancedPanel.getPreferredSize().width, 25); jtfArgs.setPreferredSize(d); // mtlOptions.setPreferredSize(new Dimension(350, getPreferredSize().height)); d.width = -1; d.height = -1; JLabel tabLabel = null; int tabs = mtlOptions.getTabCount(); while (tabs-- > 0) { Component tab = mtlOptions.getTabComponentAt(tabs); if (tab == null) { if (tabLabel == null) tabLabel = new JLabel(); tabLabel.setText(mtlOptions.getTitleAt(tabs)); tab = tabLabel; } Dimension dim = tab.getPreferredSize(); d.width = Math.max(dim.width, d.width); d.height = Math.max(dim.height, d.height); } // Set width to width of largest tab * number of tabs, then add 20%. d.width = d.width * 120 / 100 * mtlOptions.getTabCount(); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setIconImage(icon.getImage()); // To prevent the tabs from wrapping or scrolling setMinimumSize(new Dimension(d.width, getSize().height)); pack(); setResizable(true); }
From source file:com.diversityarrays.kdxplore.curate.TrialDataEditor.java
private List<JButton> createVisualisationButtons() { List<JButton> visButtons = new ArrayList<>(); for (final VisualisationTool tool : visualisationTools) { JButton button = new JButton(); button.setBorder(new CompoundBorder(new EmptyBorder(2, 2, 2, 2), BorderFactory.createBevelBorder(BevelBorder.RAISED))); Icon icon = tool.getToolIcon(); if (icon != null) { button.setIcon(icon);/* ww w .j a v a 2 s . c o m*/ } else { button.setName(tool.getToolButtonName()); } boolean onlyForDeveloper = false; VisualisationToolActionListener actionListener = new VisualisationToolActionListener( TrialDataEditor.this, getTitle(), onlyForDeveloper, curationContext, tool); button.addActionListener(actionListener); visButtons.add(button); button.setText(tool.getToolName()); } return visButtons; }
From source file:edu.ku.brc.af.ui.forms.ViewFactory.java
/** * Sets a border on the component as defined in the properties. * @param comp the component//from www. ja va 2s. c o m * @param props the list of properties */ protected void setBorder(final JComponent comp, final Properties props) { if (props != null) { String borderType = props.getProperty("border"); if (StringUtils.isNotEmpty(borderType)) { if (borderType.equals("etched")) { comp.setBorder(BorderFactory.createEtchedBorder()); } else if (borderType.equals("lowered")) { comp.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); } else if (borderType.equals("raised")) { comp.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); } else if (borderType.equals("empty")) { comp.setBorder(BorderFactory.createEmptyBorder()); } else if (borderType.equals("line")) { Color color = Color.LIGHT_GRAY; String borderColor = props.getProperty("bordercolor"); if (StringUtils.isNotEmpty(borderColor)) { try { color = UIHelper.parseRGB(borderColor); } catch (ConfigurationException ex) { log.error(ex); } } comp.setBorder(BorderFactory.createLineBorder(color)); } } } }
From source file:org.mbs3.juniuploader.gui.frmMain.java
private void initGUI() { try {//from w ww . j a v a2 s. c o m BorderLayout thisLayout = new BorderLayout(); getContentPane().setLayout(thisLayout); this.setTitle("jUniUploader " + jUniUploader.VERSION); { lblStatus = new JLabel(); getContentPane().add(lblStatus, BorderLayout.SOUTH); lblStatus.setText("Lots of status text will go here"); lblStatus.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); } { jTabbedPane1 = new JTabbedPane(); getContentPane().add(jTabbedPane1, BorderLayout.CENTER); jTabbedPane1.setPreferredSize(new java.awt.Dimension(665, 402)); { pnlMainMenu1 = new pnlMainMenu(); jTabbedPane1.addTab("Main Menu", null, getPnlMainMenu1(), null); } { pnlWoWDirectories1 = new pnlWoWDirectories(); jTabbedPane1.addTab("WoW Directories", null, getPnlWoWDirectories1(), null); } { pnlRemoteInterface1 = new pnlRemoteInterface(); jTabbedPane1.addTab("UniAdmin Interface", null, getPnlRemoteInterface1(), null); } { pnlUploadSites1 = new pnlUploadSites(); jTabbedPane1.addTab("Upload Sites", null, getPnlUploadSites1(), null); } { pnlFormVariables1 = new pnlFormVariables(); jTabbedPane1.addTab("Form Variables", null, getPnlFormVariables1(), null); } { pnlUploadRules1 = new pnlUploadRules(); jTabbedPane1.addTab("Upload Rules", null, getPnlUploadRules1(), null); } { pnlDebug1 = new pnlDebug(); jTabbedPane1.addTab("Debug Log", null, pnlDebug1, null); } { pnlLoggingOptions1 = new pnlSettings(); jTabbedPane1.addTab("Application Settings", null, getPnlLoggingOptions1(), null); } { pnlAbout1 = new pnlAbout(); jTabbedPane1.addTab("About", null, getPnlAbout1(), null); } } this.setSize(673, 456); jMenuBar1 = new JMenuBar(); setJMenuBar(jMenuBar1); jMenu3 = new JMenu(); jMenuBar1.add(jMenu3); jMenu3.setText("File"); newFileMenuItem = new JMenuItem(); jMenu3.add(newFileMenuItem); newFileMenuItem.setText("New"); openFileMenuItem = new JMenuItem(); jMenu3.add(openFileMenuItem); openFileMenuItem.setText("Open"); saveMenuItem = new JMenuItem(); jMenu3.add(saveMenuItem); saveMenuItem.setText("Save"); saveAsMenuItem = new JMenuItem(); jMenu3.add(saveAsMenuItem); saveAsMenuItem.setText("Save As ..."); closeFileMenuItem = new JMenuItem(); jMenu3.add(closeFileMenuItem); closeFileMenuItem.setText("Close"); jSeparator2 = new JSeparator(); jMenu3.add(jSeparator2); exitMenuItem = new JMenuItem(); jMenu3.add(exitMenuItem); exitMenuItem.setText("Exit"); exitMenuItem.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { exitMenuItemActionPerformed(evt); } }); jMenu4 = new JMenu(); jMenuBar1.add(jMenu4); jMenu4.setText("Edit"); jMenu4.setEnabled(false); cutMenuItem = new JMenuItem(); jMenu4.add(cutMenuItem); cutMenuItem.setText("Cut"); copyMenuItem = new JMenuItem(); jMenu4.add(copyMenuItem); copyMenuItem.setText("Copy"); pasteMenuItem = new JMenuItem(); jMenu4.add(pasteMenuItem); pasteMenuItem.setText("Paste"); jSeparator1 = new JSeparator(); jMenu4.add(jSeparator1); deleteMenuItem = new JMenuItem(); jMenu4.add(deleteMenuItem); deleteMenuItem.setText("Delete"); jMenu5 = new JMenu(); jMenuBar1.add(jMenu5); jMenu5.setText("Help"); helpMenuItem = new JMenuItem(); jMenu5.add(helpMenuItem); helpMenuItem.setText("Help"); } catch (Exception ex) { log.error("Error", ex); } }
From source file:org.openmicroscopy.shoola.agents.dataBrowser.view.PopupMenu.java
/** Builds and lays out the GUI. */ private void buildGUI() { setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); if (model.getType() == DataBrowserModel.GROUP) { add(resetPassword);/*from w ww . j a v a2 s.c o m*/ add(activatedUser); add(buildEditMenu()); add(removeElement); } else { JMenu menu; String text = "View"; switch (DataBrowserAgent.runAsPlugin()) { case DataBrowser.IMAGE_J: menu = new JMenu(text); menu.setIcon(view.getIcon()); menu.add(view); menu.add(controller.getAction(DataBrowserControl.VIEW_IN_IJ)); add(menu); break; case DataBrowser.KNIME: menu = new JMenu(text); menu.setIcon(view.getIcon()); menu.add(view); menu.add(controller.getAction(DataBrowserControl.VIEW_IN_KNIME)); add(menu); break; default: add(view); } ; add(openWithMenu); add(new JSeparator(JSeparator.HORIZONTAL)); add(buildEditMenu()); add(removeElement); JMenu m = createMoveToMenu(); if (m != null) add(m); add(new JSeparator(JSeparator.HORIZONTAL)); add(tagElement); add(newExperimentElement); add(new JSeparator(JSeparator.HORIZONTAL)); add(buildRenderingSettingsMenu()); } }
From source file:org.openmicroscopy.shoola.agents.fsimporter.view.ImporterUI.java
/** * Brings up the <code>ManagePopupMenu</code>on top of the specified * component at the specified location.//from www . j a v a 2s . c o m * * @param c The component that requested the po-pup menu. * @param p The point at which to display the menu, relative to the * <code>component</code>'s coordinates. */ private void showPersonalMenu(Component c, Point p) { if (p == null) return; if (c == null) throw new IllegalArgumentException("No component."); personalMenu = new JPopupMenu(); personalMenu.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); List<GroupSelectionAction> l = controller.getUserGroupAction(); Iterator<GroupSelectionAction> i = l.iterator(); GroupSelectionAction a; JCheckBoxMenuItem item; ButtonGroup buttonGroup = new ButtonGroup(); long id = model.getGroupId(); while (i.hasNext()) { a = i.next(); item = new JCheckBoxMenuItem(a); item.setEnabled(true); item.setSelected(a.isSameGroup(id)); initMenuItem(item); buttonGroup.add(item); personalMenu.add(item); } personalMenu.show(c, p.x, p.y); }
From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java
/** * Brings up the <code>Personal Menu</code> on top of the specified * component at the specified location./*from w ww . j ava 2 s. co m*/ * * @param c The component that requested the pop-up menu. * @param p The point at which to display the menu, relative to the * <code>component</code>'s coordinates. */ void showPersonalMenu(Component c, Point p) { if (p == null) return; if (c == null) throw new IllegalArgumentException("No component."); personalMenu = new JPopupMenu(); personalMenu.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); List<JMenuItem> l = createMenuItem(false); Iterator<JMenuItem> i = l.iterator(); while (i.hasNext()) { personalMenu.add(i.next()); } personalMenu.show(c, p.x, p.y); }
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Sets the defaults for the specified area. * /*from w ww .jav a2s .c o m*/ * @param area The text area. */ public static void setTextAreaDefault(JComponent area) { if (area == null) return; area.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED)); //area.setForeground(STEELBLUE); area.setBackground(BACKGROUND); area.setOpaque(true); if (area instanceof JTextComponent) ((JTextComponent) area).setEditable(true); }