List of usage examples for javax.swing.border EtchedBorder EtchedBorder
public EtchedBorder(int etchType)
From source file:MainClass.java
public static void main(String[] a) { JFrame frame = new JFrame("Etched Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border raisedBorder = new EtchedBorder(EtchedBorder.RAISED); Border loweredBorder = new EtchedBorder(EtchedBorder.LOWERED); JButton raisedButton = new JButton("Raised"); raisedButton.setBorder(raisedBorder); JButton loweredButton = new JButton("Lowered"); loweredButton.setBorder(loweredBorder); Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(1, 2, 5, 5)); contentPane.add(raisedButton);// www.ja v a2s. c o m contentPane.add(loweredButton); frame.setSize(300, 100); frame.setVisible(true); }
From source file:AnEtchedBorder.java
public static void main(String args[]) { JFrame frame = new JFrame("Etched Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border raisedBorder = new EtchedBorder(EtchedBorder.RAISED); Border loweredBorder = new EtchedBorder(EtchedBorder.LOWERED); JButton raisedButton = new JButton("Raised"); raisedButton.setBorder(raisedBorder); JButton loweredButton = new JButton("Lowered"); loweredButton.setBorder(loweredBorder); Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(1, 2, 5, 5)); contentPane.add(raisedButton);/*from w ww .j av a 2 s.c o m*/ contentPane.add(loweredButton); frame.setSize(300, 100); frame.setVisible(true); }
From source file:AnEtchedBorder.java
public static void main(String args[]) { JFrame frame = new JFrame("Etched Borders"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Border raisedBorder = new EtchedBorder(EtchedBorder.RAISED); Border loweredBorder = new EtchedBorder(EtchedBorder.LOWERED); JButton raisedButton = new JButton("Raised"); raisedButton.setBorder(raisedBorder); JButton loweredButton = new JButton("Lowered"); loweredButton.setBorder(loweredBorder); Container contentPane = frame.getContentPane(); contentPane.setLayout(new GridLayout(1, 2, 5, 5)); contentPane.add(raisedButton);//from w w w . j av a 2s. com contentPane.add(loweredButton); frame.setSize(300, 100); frame.setVisible(true); }
From source file:TryBorderLayout.java
public static void main(String[] args) { JFrame aWindow = new JFrame("This is a Border Layout"); aWindow.setBounds(30, 30, 300, 300); // Size aWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); BorderLayout border = new BorderLayout(); // Create a layout manager Container content = aWindow.getContentPane(); // Get the content pane content.setLayout(border); // Set the container layout mgr EtchedBorder edge = new EtchedBorder(EtchedBorder.RAISED); // Button border // Now add five JButton components and set their borders JButton button;/*from w w w . j ava2 s . co m*/ content.add(button = new JButton("EAST"), BorderLayout.EAST); button.setBorder(edge); content.add(button = new JButton("WEST"), BorderLayout.WEST); button.setBorder(edge); content.add(button = new JButton("NORTH"), BorderLayout.NORTH); button.setBorder(edge); content.add(button = new JButton("SOUTH"), BorderLayout.SOUTH); button.setBorder(edge); content.add(button = new JButton("CENTER"), BorderLayout.CENTER); button.setBorder(edge); aWindow.setVisible(true); // Display the window }
From source file:AnotherBorderTest.java
public AnotherBorderTest() { setTitle("Border Test"); setSize(450, 450);/*ww w . ja va 2 s.c o m*/ JPanel content = (JPanel) getContentPane(); content.setLayout(new GridLayout(6, 2, 3, 3)); JPanel p = new JPanel(); p.setBorder(new BevelBorder(BevelBorder.RAISED)); p.add(new JLabel("RAISED BevelBorder")); content.add(p); p = new JPanel(); p.setBorder(new BevelBorder(BevelBorder.LOWERED)); p.add(new JLabel("LOWERED BevelBorder")); content.add(p); p = new JPanel(); p.setBorder(new LineBorder(Color.black, 5)); p.add(new JLabel("Black LineBorder, thickness = 5")); content.add(p); p = new JPanel(); p.setBorder(new EmptyBorder(10, 10, 10, 10)); p.add(new JLabel("EmptyBorder with thickness of 10")); content.add(p); p = new JPanel(); p.setBorder(new EtchedBorder(EtchedBorder.RAISED)); p.add(new JLabel("RAISED EtchedBorder")); content.add(p); p = new JPanel(); p.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); p.add(new JLabel("LOWERED EtchedBorder")); content.add(p); p = new JPanel(); p.setBorder(new SoftBevelBorder(SoftBevelBorder.RAISED)); p.add(new JLabel("RAISED SoftBevelBorder")); content.add(p); p = new JPanel(); p.setBorder(new SoftBevelBorder(SoftBevelBorder.LOWERED)); p.add(new JLabel("LOWERED SoftBevelBorder")); content.add(p); p = new JPanel(); p.setBorder(new MatteBorder(new ImageIcon("BALL.GIF"))); p.add(new JLabel("MatteBorder")); content.add(p); p = new JPanel(); p.setBorder(new TitledBorder(new MatteBorder(new ImageIcon("java2sLogo.gif")), "Title String")); p.add(new JLabel("TitledBorder using MatteBorder")); content.add(p); p = new JPanel(); p.setBorder(new TitledBorder(new LineBorder(Color.black, 5), "Title String")); p.add(new JLabel("TitledBorder using LineBorder")); content.add(p); p = new JPanel(); p.setBorder(new TitledBorder(new EmptyBorder(10, 10, 10, 10), "Title String")); p.add(new JLabel("TitledBorder using EmptyBorder")); content.add(p); setVisible(true); }
From source file:net.sf.taverna.raven.plugins.ui.CheckForUpdatesDialog.java
private void initComponents() { // Base font for all components on the form Font baseFont = new JLabel("base font").getFont().deriveFont(11f); // Message saying that updates are available JPanel messagePanel = new JPanel(new BorderLayout()); messagePanel.setBorder(//from w w w .j a v a 2s. co m new CompoundBorder(new EmptyBorder(10, 10, 10, 10), new EtchedBorder(EtchedBorder.LOWERED))); JLabel message = new JLabel( "<html><body>Updates are available for some Taverna components. To review and <br>install them go to 'Updates and plugins' in the 'Advanced' menu.</body><html>"); message.setFont(baseFont.deriveFont(12f)); message.setBorder(new EmptyBorder(5, 5, 5, 5)); message.setIcon(UpdatesAvailableIcon.updateIcon); messagePanel.add(message, BorderLayout.CENTER); // Buttons JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); JButton okButton = new JButton("OK"); // we'll check for updates again in 2 weeks okButton.setFont(baseFont); okButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { okPressed(); } }); buttonsPanel.add(okButton); getContentPane().setLayout(new BorderLayout()); getContentPane().add(messagePanel, BorderLayout.CENTER); getContentPane().add(buttonsPanel, BorderLayout.SOUTH); pack(); setResizable(false); // Center the dialog on the screen (we do not have the parent) Dimension dimension = getToolkit().getScreenSize(); Rectangle abounds = getBounds(); setLocation((dimension.width - abounds.width) / 2, (dimension.height - abounds.height) / 2); setSize(getPreferredSize()); }
From source file:com.geometrycloud.happydonut.swing.ImagePanel.java
@Override public Border getBorder() { return new EtchedBorder(EtchedBorder.LOWERED); }
From source file:net.sf.taverna.t2.workbench.ui.credentialmanager.WarnUserAboutJCEPolicyDialog.java
private void initComponents() { // Base font for all components on the form Font baseFont = new JLabel("base font").getFont().deriveFont(11f); // Message saying that updates are available JPanel messagePanel = new JPanel(new BorderLayout()); messagePanel.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10, 10), new EtchedBorder(LOWERED))); JEditorPane message = new JEditorPane(); message.setEditable(false);/* ww w . j av a 2 s .c om*/ message.setBackground(this.getBackground()); message.setFocusable(false); HTMLEditorKit kit = new HTMLEditorKit(); message.setEditorKit(kit); StyleSheet styleSheet = kit.getStyleSheet(); //styleSheet.addRule("body {font-family:"+baseFont.getFamily()+"; font-size:"+baseFont.getSize()+";}"); // base font looks bigger when rendered as HTML styleSheet.addRule("body {font-family:" + baseFont.getFamily() + "; font-size:10px;}"); Document doc = kit.createDefaultDocument(); message.setDocument(doc); message.setText( "<html><body>In order for Taverna's security features to function properly - you need to install<br>" + "'Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy'. <br><br>" + "If you do not already have it, for <b>Java 6</b> you can get it from:<br>" + "<a href=\"http://www.oracle.com/technetwork/java/javase/downloads/index.html\">http://www.oracle.com/technetwork/java/javase/downloads/index.html</a><br<br>" + "Installation instructions are contained in the bundle you download." + "</body><html>"); message.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent he) { HyperlinkEvent.EventType type = he.getEventType(); if (type == ACTIVATED) // Open a Web browser try { getDesktop().browse(he.getURL().toURI()); // BrowserLauncher launcher = new BrowserLauncher(); // launcher.openURLinBrowser(he.getURL().toString()); } catch (Exception ex) { logger.error("Failed to launch browser to fetch JCE " + he.getURL()); } } }); message.setBorder(new EmptyBorder(5, 5, 5, 5)); messagePanel.add(message, CENTER); doNotWarnMeAgainCheckBox = new JCheckBox("Do not warn me again"); doNotWarnMeAgainCheckBox.setFont(baseFont.deriveFont(12f)); messagePanel.add(doNotWarnMeAgainCheckBox, SOUTH); // Buttons JPanel buttonsPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); JButton okButton = new JButton("OK"); okButton.setFont(baseFont); okButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { okPressed(); } }); buttonsPanel.add(okButton); getContentPane().setLayout(new BorderLayout()); getContentPane().add(messagePanel, CENTER); getContentPane().add(buttonsPanel, SOUTH); pack(); setResizable(false); // Center the dialog on the screen (we do not have the parent) Dimension dimension = getToolkit().getScreenSize(); Rectangle abounds = getBounds(); setLocation((dimension.width - abounds.width) / 2, (dimension.height - abounds.height) / 2); setSize(getPreferredSize()); }
From source file:edu.ku.brc.ui.ImageDisplay.java
/** * Constructor./*from w w w .ja v a 2 s . c o m*/ * @param imgWidth the desired image width * @param imgHeight the desired image height * @param isEditMode whether it is in browse mode or edit mode * @param hasBorder whether it has a border */ public ImageDisplay(final int imgWidth, final int imgHeight, boolean isEditMode, boolean hasBorder) { super(new BorderLayout()); setBorder(hasBorder ? new EtchedBorder(EtchedBorder.LOWERED) : BorderFactory.createEmptyBorder()); setPreferredSize(new Dimension(imgWidth, imgHeight)); this.isEditMode = isEditMode; this.paintComponent = this; createUI(); setDoubleBuffered(true); }
From source file:de.huxhorn.lilith.swing.MainFrame.java
public MainFrame(ApplicationPreferences applicationPreferences, SplashScreen splashScreen, String appName, boolean enableBonjour) { super(appName); this.applicationPreferences = applicationPreferences; this.coloringWholeRow = this.applicationPreferences.isColoringWholeRow(); this.splashScreen = splashScreen; setSplashStatusText("Creating main frame."); groovyFormatter = new GroovyEventWrapperHtmlFormatter(applicationPreferences); thymeleafFormatter = new ThymeleafEventWrapperHtmlFormatter(applicationPreferences); smallProgressIcon = new ImageIcon(MainFrame.class.getResource("/otherGraphics/Progress16.gif")); ImageIcon frameIcon = new ImageIcon(MainFrame.class.getResource("/otherGraphics/Lilith16.jpg")); setIconImage(frameIcon.getImage());//from www .j ava 2s . c o m //colorsReferenceQueue=new ReferenceQueue<Colors>(); //colorsCache=new ConcurrentHashMap<EventIdentifier, SoftColorsReference>(); application = new DefaultApplication(); autostartProcesses = new ArrayList<AutostartRunnable>(); addWindowListener(new MainWindowListener()); setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); // fixes ticket #79 Runtime runtime = Runtime.getRuntime(); Thread shutdownHook = new Thread(new ShutdownRunnable()); runtime.addShutdownHook(shutdownHook); senderService = new SenderService(this); this.enableBonjour = enableBonjour; /* if(application.isMac()) { setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE); } else { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } */ longTaskManager = new TaskManager<Long>(); longTaskManager.setUsingEventQueue(true); longTaskManager.startUp(); longTaskManager.addTaskListener(new MainTaskListener()); startupApplicationPath = this.applicationPreferences.getStartupApplicationPath(); loggingFileFactory = new LogFileFactoryImpl(new File(startupApplicationPath, LOGGING_FILE_SUBDIRECTORY)); accessFileFactory = new LogFileFactoryImpl(new File(startupApplicationPath, ACCESS_FILE_SUBDIRECTORY)); Map<String, String> loggingMetaData = new HashMap<String, String>(); loggingMetaData.put(FileConstants.CONTENT_TYPE_KEY, FileConstants.CONTENT_TYPE_VALUE_LOGGING); loggingMetaData.put(FileConstants.CONTENT_FORMAT_KEY, FileConstants.CONTENT_FORMAT_VALUE_PROTOBUF); loggingMetaData.put(FileConstants.COMPRESSION_KEY, FileConstants.COMPRESSION_VALUE_GZIP); // TODO: configurable format and compressed loggingFileBufferFactory = new LoggingFileBufferFactory(loggingFileFactory, loggingMetaData); Map<String, String> accessMetaData = new HashMap<String, String>(); accessMetaData.put(FileConstants.CONTENT_TYPE_KEY, FileConstants.CONTENT_TYPE_VALUE_ACCESS); accessMetaData.put(FileConstants.CONTENT_FORMAT_KEY, FileConstants.CONTENT_FORMAT_VALUE_PROTOBUF); accessMetaData.put(FileConstants.COMPRESSION_KEY, FileConstants.COMPRESSION_VALUE_GZIP); // TODO: configurable format and compressed accessFileBufferFactory = new AccessFileBufferFactory(accessFileFactory, accessMetaData); rrdFileFilter = new RrdFileFilter(); loggingEventViewManager = new LoggingEventViewManager(this); accessEventViewManager = new AccessEventViewManager(this); this.applicationPreferences.addPropertyChangeListener(new PreferencesChangeListener()); loggingSourceListener = new LoggingEventSourceListener(); accessSourceListener = new AccessEventSourceListener(); // this.cleanupWindowChangeListener = new CleanupWindowChangeListener(); desktop = new JDesktopPane(); statusBar = new JPanel(new GridBagLayout()); GridBagConstraints gbc = new GridBagConstraints(); statusLabel = new JLabel(); statusLabel.setText("Starting..."); gbc.fill = GridBagConstraints.HORIZONTAL; gbc.gridx = 0; gbc.gridy = 0; gbc.weightx = 0.0; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 0); statusBar.add(statusLabel, gbc); taskStatusLabel = new JLabel(); taskStatusLabel.setText(""); taskStatusLabel.setForeground(Color.BLUE); taskStatusLabel.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent mouseEvent) { showTaskManager(); } @Override public void mouseEntered(MouseEvent mouseEvent) { taskStatusLabel.setForeground(Color.RED); } @Override public void mouseExited(MouseEvent mouseEvent) { taskStatusLabel.setForeground(Color.BLUE); } }); gbc.gridx = 1; gbc.gridy = 0; gbc.weightx = 1.0; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 5, 0, 0); statusBar.add(taskStatusLabel, gbc); MemoryStatus memoryStatus = new MemoryStatus(); memoryStatus.setBackground(Color.WHITE); memoryStatus.setOpaque(true); memoryStatus.setUsingBinaryUnits(true); memoryStatus.setUsingTotal(false); memoryStatus.setBorder(new EtchedBorder(EtchedBorder.LOWERED)); gbc.fill = GridBagConstraints.NONE; gbc.gridx = 2; gbc.gridy = 0; gbc.weightx = 0.0; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(0, 0, 0, 0); statusBar.add(memoryStatus, gbc); add(desktop, BorderLayout.CENTER); add(statusBar, BorderLayout.SOUTH); if (SystemUtils.IS_JAVA_1_6) { setSplashStatusText("Creating statistics dialog."); if (logger.isDebugEnabled()) logger.debug("Before creation of statistics-dialog..."); statisticsDialog = new StatisticsDialog(this); if (logger.isDebugEnabled()) logger.debug("After creation of statistics-dialog..."); } setSplashStatusText("Creating about dialog."); aboutDialog = new AboutDialog(this, "About " + appName + "...", appName); setSplashStatusText("Creating update dialog."); checkForUpdateDialog = new CheckForUpdateDialog(this); setSplashStatusText("Creating debug dialog."); debugDialog = new DebugDialog(this, this); setSplashStatusText("Creating preferences dialog."); if (logger.isDebugEnabled()) logger.debug("Before creation of preferences-dialog..."); preferencesDialog = new PreferencesDialog(this); if (logger.isDebugEnabled()) logger.debug("After creation of preferences-dialog..."); setSplashStatusText("Creating \"Open inactive\" dialog."); openInactiveLogsDialog = new OpenPreviousDialog(MainFrame.this); setSplashStatusText("Creating help frame."); helpFrame = new HelpFrame(this); helpFrame.setTitle("Help Topics"); openFileChooser = new JFileChooser(); openFileChooser.setFileFilter(new LilithFileFilter()); openFileChooser.setFileHidingEnabled(false); openFileChooser.setCurrentDirectory(this.applicationPreferences.getPreviousOpenPath()); importFileChooser = new JFileChooser(); importFileChooser.setFileFilter(new XmlImportFileFilter()); importFileChooser.setFileHidingEnabled(false); importFileChooser.setCurrentDirectory(this.applicationPreferences.getPreviousImportPath()); exportFileChooser = new JFileChooser(); exportFileChooser.setFileFilter(new LilithFileFilter()); exportFileChooser.setFileHidingEnabled(false); exportFileChooser.setCurrentDirectory(this.applicationPreferences.getPreviousExportPath()); setSplashStatusText("Creating task manager frame."); taskManagerFrame = new TaskManagerInternalFrame(this); taskManagerFrame.setTitle("Task Manager"); taskManagerFrame.setDefaultCloseOperation(JInternalFrame.HIDE_ON_CLOSE); taskManagerFrame.setBounds(0, 0, 320, 240); desktop.add(taskManagerFrame); desktop.validate(); // the following code must be executed after desktop has been initialized... try { // try to use the 1.6 transfer handler... new MainFrameTransferHandler16(this).attach(); } catch (Throwable t) { // ... and use the basic 1.5 transfer handler if this fails. new MainFrameTransferHandler(this).attach(); } setSplashStatusText("Creating Tip of the Day dialog."); tipOfTheDayDialog = new TipOfTheDayDialog(this); setSplashStatusText("Creating actions and menus."); viewActions = new ViewActions(this, null); viewActions.getPopupMenu(); // initialize popup once in main frame only. JMenuBar menuBar = viewActions.getMenuBar(); toolbar = viewActions.getToolbar(); add(toolbar, BorderLayout.NORTH); setJMenuBar(menuBar); setShowingToolbar(applicationPreferences.isShowingToolbar()); setShowingStatusbar(applicationPreferences.isShowingStatusbar()); }