Java Code Examples for javax.swing.JTextArea#setDisabledTextColor()
The following examples show how to use
javax.swing.JTextArea#setDisabledTextColor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExceptionUI.java From bytecode-viewer with GNU General Public License v3.0 | 6 votes |
private void setup(Throwable e, String author) { this.setIconImages(Resources.iconList); setSize(new Dimension(600, 400)); setTitle("Bytecode Viewer " + BytecodeViewer.VERSION + " - Stack Trace - Send this to " + author); getContentPane().setLayout(new CardLayout(0, 0)); JTextArea txtrBytecodeViewerIs = new JTextArea(); txtrBytecodeViewerIs.setDisabledTextColor(Color.BLACK); txtrBytecodeViewerIs.setWrapStyleWord(true); getContentPane().add(new JScrollPane(txtrBytecodeViewerIs), "name_140466576080695"); StringWriter sw = new StringWriter(); e.printStackTrace(new PrintWriter(sw)); e.printStackTrace(); txtrBytecodeViewerIs.setText("Bytecode Viewer Version: " + BytecodeViewer.VERSION + ", Preview Copy: " + BytecodeViewer.PREVIEW_COPY + ", Fat Jar: " + BytecodeViewer.FAT_JAR + ", OS: " + System.getProperty("os.name") + ", Java: " + System.getProperty("java.version") + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString()); this.setLocationRelativeTo(null); this.setVisible(true); }
Example 2
Source File: ExceptionUI.java From bytecode-viewer with GNU General Public License v3.0 | 6 votes |
private void setup(String e, String author) { this.setIconImages(Resources.iconList); setSize(new Dimension(600, 400)); setTitle("Bytecode Viewer " + BytecodeViewer.VERSION + " - Stack Trace - Send this to " + author); getContentPane().setLayout(new CardLayout(0, 0)); JTextArea txtrBytecodeViewerIs = new JTextArea(); txtrBytecodeViewerIs.setDisabledTextColor(Color.BLACK); txtrBytecodeViewerIs.setWrapStyleWord(true); getContentPane().add(new JScrollPane(txtrBytecodeViewerIs), "name_140466576080695"); txtrBytecodeViewerIs.setText(e); System.err.println(e); this.setLocationRelativeTo(null); this.setVisible(true); }
Example 3
Source File: GuiUtils.java From netbeans with Apache License 2.0 | 5 votes |
/** * Creates a text component to be used as a multi-line, automatically * wrapping label. * <p> * <strong>Restriction:</strong><br> * The component may have its preferred size very wide. * * @param text text of the label * @param color desired color of the label, * or {@code null} if the default color should be used * @return created multi-line text component */ public static JTextComponent createMultilineLabel(String text, Color color) { JTextArea textArea = new JTextArea(text); textArea.setEditable(false); textArea.setLineWrap(true); textArea.setWrapStyleWord(true); textArea.setEnabled(false); textArea.setOpaque(false); textArea.setColumns(25); textArea.setDisabledTextColor((color != null) ? color : new JLabel().getForeground()); return textArea; }
Example 4
Source File: InstancesView.java From netbeans with Apache License 2.0 | 5 votes |
public SuspendInfoPanel() { setLayout(new java.awt.GridBagLayout()); JTextArea infoText = new JTextArea(NbBundle.getMessage(InstancesView.class, "MSG_NotSuspendedApp")); infoText.setEditable(false); infoText.setEnabled(false); infoText.setBackground(getBackground()); infoText.setDisabledTextColor(new JLabel().getForeground()); infoText.setLineWrap(true); infoText.setWrapStyleWord(true); infoText.setPreferredSize( new Dimension( infoText.getFontMetrics(infoText.getFont()).stringWidth(infoText.getText()), infoText.getPreferredSize().height)); GridBagConstraints gridBagConstraints = new GridBagConstraints(); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 1; //gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL; //gridBagConstraints.weightx = 1.0; gridBagConstraints.anchor = java.awt.GridBagConstraints.CENTER; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); add(infoText, gridBagConstraints); infoText.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(InstancesView.class, "MSG_NotSuspendedApp")); JButton pauseButton = new JButton(); pauseButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { doStopCurrentDebugger(); } }); org.openide.awt.Mnemonics.setLocalizedText(pauseButton, NbBundle.getMessage(InstancesView.class, "CTL_Pause")); pauseButton.setIcon(ImageUtilities.loadImageIcon("org/netbeans/modules/debugger/resources/actions/Pause.gif", false)); gridBagConstraints.gridx = 0; gridBagConstraints.gridy = 2; gridBagConstraints.anchor = java.awt.GridBagConstraints.CENTER; gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5); add(pauseButton, gridBagConstraints); }
Example 5
Source File: DeprecationWarning.java From rapidminer-studio with GNU Affero General Public License v3.0 | 5 votes |
/** * Creates a multiline text label, which does not support HTML * * @param text * the text of the label * @return a multi line label */ private static JComponent createMultiLineLabel(String text) { JTextArea flowLabel = new JTextArea(text, 1, 0); flowLabel.setDisabledTextColor(flowLabel.getForeground()); flowLabel.setMinimumSize(new Dimension(20, 40)); flowLabel.setBackground(null); flowLabel.setLineWrap(true); flowLabel.setWrapStyleWord(true); flowLabel.setBorder(BorderFactory.createEmptyBorder()); flowLabel.setOpaque(false); flowLabel.setEnabled(false); return flowLabel; }
Example 6
Source File: DDChangesPanel.java From netbeans with Apache License 2.0 | 4 votes |
/** Initializes the Form */ public DDChangesPanel (String caption, final JButton processButton) { setLayout (new java.awt.BorderLayout (0, 12)); setBorder (new EmptyBorder (12, 12, 11, 0)); JTextArea text = new JTextArea (); text.setEnabled (false); text.setEditable (false); text.setDisabledTextColor (UIManager.getColor ("Label.foreground")); // NOI18N text.setBackground (UIManager.getColor ("Label.background")); // NOI18N text.setLineWrap (true); text.setWrapStyleWord (true); text.setText (caption); add (text, "North"); // NOI18N changesPanel = new JPanel (); changesPanel.setLayout (new java.awt.BorderLayout (5, 5)); JLabel changesLabel = new JLabel (); changesLabel.setText (NbBundle.getMessage (DDChangesPanel.class, "LAB_ChangesList")); changesLabel.getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage (DDChangesPanel.class, "ACS_ChangesListA11yDesc")); // NOI18N changesPanel.add (changesLabel, "North"); // NOI18N jScrollPane1 = new JScrollPane (); listModel = new DefaultListModel (); changesList = new JList (listModel); changesList.setToolTipText (NbBundle.getMessage (DDChangesPanel.class, "HINT_ChangesList")); changesList.setCellRenderer (new ChangesListCellRenderer ()); changesList.addListSelectionListener (new ListSelectionListener () { public void valueChanged (ListSelectionEvent e) { processButton.setEnabled (!changesList.isSelectionEmpty ()); } }); changesLabel.setLabelFor (changesList); changesLabel.setDisplayedMnemonic (NbBundle.getMessage (DDChangesPanel.class, "LAB_ChangesList_Mnemonic").charAt (0)); getAccessibleContext().setAccessibleDescription(NbBundle.getMessage (DDChangesPanel.class, "ACS_ChangesListA11yPanelDesc")); jScrollPane1.setViewportView (changesList); changesPanel.add (jScrollPane1, "Center"); // NOI18N add (changesPanel, "Center"); // NOI18N }
Example 7
Source File: XTextAreaPeer.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Override public void installUI(JComponent c) { super.installUI(c); jta = (JTextArea) c; JTextArea editor = jta; UIDefaults uidefaults = XToolkit.getUIDefaults(); String prefix = getPropertyPrefix(); Font f = editor.getFont(); if ((f == null) || (f instanceof UIResource)) { editor.setFont(uidefaults.getFont(prefix + ".font")); } Color bg = editor.getBackground(); if ((bg == null) || (bg instanceof UIResource)) { editor.setBackground(uidefaults.getColor(prefix + ".background")); } Color fg = editor.getForeground(); if ((fg == null) || (fg instanceof UIResource)) { editor.setForeground(uidefaults.getColor(prefix + ".foreground")); } Color color = editor.getCaretColor(); if ((color == null) || (color instanceof UIResource)) { editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground")); } Color s = editor.getSelectionColor(); if ((s == null) || (s instanceof UIResource)) { editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground")); } Color sfg = editor.getSelectedTextColor(); if ((sfg == null) || (sfg instanceof UIResource)) { editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground")); } Color dfg = editor.getDisabledTextColor(); if ((dfg == null) || (dfg instanceof UIResource)) { editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground")); } Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight); editor.setBorder(new BorderUIResource.CompoundBorderUIResource( b,new EmptyBorder(2, 2, 2, 2))); Insets margin = editor.getMargin(); if (margin == null || margin instanceof UIResource) { editor.setMargin(uidefaults.getInsets(prefix + ".margin")); } }
Example 8
Source File: XTextAreaPeer.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override public void installUI(JComponent c) { super.installUI(c); jta = (JTextArea) c; JTextArea editor = jta; UIDefaults uidefaults = XToolkit.getUIDefaults(); String prefix = getPropertyPrefix(); Font f = editor.getFont(); if ((f == null) || (f instanceof UIResource)) { editor.setFont(uidefaults.getFont(prefix + ".font")); } Color bg = editor.getBackground(); if ((bg == null) || (bg instanceof UIResource)) { editor.setBackground(uidefaults.getColor(prefix + ".background")); } Color fg = editor.getForeground(); if ((fg == null) || (fg instanceof UIResource)) { editor.setForeground(uidefaults.getColor(prefix + ".foreground")); } Color color = editor.getCaretColor(); if ((color == null) || (color instanceof UIResource)) { editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground")); } Color s = editor.getSelectionColor(); if ((s == null) || (s instanceof UIResource)) { editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground")); } Color sfg = editor.getSelectedTextColor(); if ((sfg == null) || (sfg instanceof UIResource)) { editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground")); } Color dfg = editor.getDisabledTextColor(); if ((dfg == null) || (dfg instanceof UIResource)) { editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground")); } Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight); editor.setBorder(new BorderUIResource.CompoundBorderUIResource( b,new EmptyBorder(2, 2, 2, 2))); Insets margin = editor.getMargin(); if (margin == null || margin instanceof UIResource) { editor.setMargin(uidefaults.getInsets(prefix + ".margin")); } }
Example 9
Source File: XTextAreaPeer.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override public void installUI(JComponent c) { super.installUI(c); jta = (JTextArea) c; JTextArea editor = jta; UIDefaults uidefaults = XToolkit.getUIDefaults(); String prefix = getPropertyPrefix(); Font f = editor.getFont(); if ((f == null) || (f instanceof UIResource)) { editor.setFont(uidefaults.getFont(prefix + ".font")); } Color bg = editor.getBackground(); if ((bg == null) || (bg instanceof UIResource)) { editor.setBackground(uidefaults.getColor(prefix + ".background")); } Color fg = editor.getForeground(); if ((fg == null) || (fg instanceof UIResource)) { editor.setForeground(uidefaults.getColor(prefix + ".foreground")); } Color color = editor.getCaretColor(); if ((color == null) || (color instanceof UIResource)) { editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground")); } Color s = editor.getSelectionColor(); if ((s == null) || (s instanceof UIResource)) { editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground")); } Color sfg = editor.getSelectedTextColor(); if ((sfg == null) || (sfg instanceof UIResource)) { editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground")); } Color dfg = editor.getDisabledTextColor(); if ((dfg == null) || (dfg instanceof UIResource)) { editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground")); } Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight); editor.setBorder(new BorderUIResource.CompoundBorderUIResource( b,new EmptyBorder(2, 2, 2, 2))); Insets margin = editor.getMargin(); if (margin == null || margin instanceof UIResource) { editor.setMargin(uidefaults.getInsets(prefix + ".margin")); } }
Example 10
Source File: XTextAreaPeer.java From hottub with GNU General Public License v2.0 | 4 votes |
@Override public void installUI(JComponent c) { super.installUI(c); jta = (JTextArea) c; JTextArea editor = jta; UIDefaults uidefaults = XToolkit.getUIDefaults(); String prefix = getPropertyPrefix(); Font f = editor.getFont(); if ((f == null) || (f instanceof UIResource)) { editor.setFont(uidefaults.getFont(prefix + ".font")); } Color bg = editor.getBackground(); if ((bg == null) || (bg instanceof UIResource)) { editor.setBackground(uidefaults.getColor(prefix + ".background")); } Color fg = editor.getForeground(); if ((fg == null) || (fg instanceof UIResource)) { editor.setForeground(uidefaults.getColor(prefix + ".foreground")); } Color color = editor.getCaretColor(); if ((color == null) || (color instanceof UIResource)) { editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground")); } Color s = editor.getSelectionColor(); if ((s == null) || (s instanceof UIResource)) { editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground")); } Color sfg = editor.getSelectedTextColor(); if ((sfg == null) || (sfg instanceof UIResource)) { editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground")); } Color dfg = editor.getDisabledTextColor(); if ((dfg == null) || (dfg instanceof UIResource)) { editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground")); } Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight); editor.setBorder(new BorderUIResource.CompoundBorderUIResource( b,new EmptyBorder(2, 2, 2, 2))); Insets margin = editor.getMargin(); if (margin == null || margin instanceof UIResource) { editor.setMargin(uidefaults.getInsets(prefix + ".margin")); } }
Example 11
Source File: SplashScreen.java From pentaho-reporting with GNU Lesser General Public License v2.1 | 4 votes |
public static JPanel createSplashPanel() { final ImageIcon picture = IconLoader.getInstance().getAboutDialogPicture(); // Create the image panel final JPanel imagePanel = new JPanel( new BorderLayout() ); imagePanel.setUI( new BackgroundUI( picture ) ); imagePanel.setBorder( BorderFactory.createLineBorder( Color.DARK_GRAY ) ); // Overlay the version final JLabel versionLabel = new JLabel(); final String buildString = ReportDesignerInfo.getInstance().getVersion(); if ( buildString == null ) { versionLabel.setText( Messages.getString( "SplashScreen.DevelopmentVersion" ) ); } else { versionLabel.setText( buildString ); } versionLabel.setText( Messages.getString( "SplashScreen.Version", versionLabel.getText() ) ); versionLabel.setFont( new Font( Font.SANS_SERIF, Font.BOLD, 14 ) ); versionLabel.setOpaque( false ); versionLabel.setBackground( TRANSPARENT ); versionLabel.setForeground( DARK_GREY ); versionLabel.setBorder( BORDER ); versionLabel.setBounds( XLOC, YLOC, TEXT_WIDTH, versionLabel.getPreferredSize().height ); // Overlay the license final String year = new SimpleDateFormat( "yyyy" ).format( new Date() ); final JTextArea copyrightArea = new JTextArea( Messages.getString( "SplashScreen.Copyright", year ) ); copyrightArea.setEditable( false ); copyrightArea.setBounds( XLOC, YLOC + 20, TEXT_WIDTH, LICENSE_HEIGHT ); copyrightArea.setOpaque( false ); copyrightArea.setLineWrap( true ); copyrightArea.setWrapStyleWord( true ); copyrightArea.setFont( COPYRIGHT_FONT ); copyrightArea.setEnabled( false ); copyrightArea.setBackground( TRANSPARENT ); copyrightArea.setForeground( DARK_GREY ); copyrightArea.setBorder( BORDER ); copyrightArea.setDisabledTextColor( copyrightArea.getForeground() ); // Overlay the copyright final JTextArea licenseArea = new JTextArea( Messages.getString( "SplashScreen.License" ) ); licenseArea.setEditable( false ); licenseArea.setBounds( XLOC, YLOC + 14 + LICENSE_HEIGHT, TEXT_WIDTH, COPYRIGHT_HEIGHT ); licenseArea.setOpaque( false ); licenseArea.setLineWrap( true ); licenseArea.setWrapStyleWord( true ); licenseArea.setFont( LICENSE_FONT ); licenseArea.setEnabled( false ); licenseArea.setBackground( TRANSPARENT ); licenseArea.setBorder( BORDER ); licenseArea.setDisabledTextColor( copyrightArea.getForeground() ); // Add all the overlays final JPanel imagePanelOverlay = new JPanel( null ); imagePanelOverlay.setOpaque( false ); imagePanelOverlay.add( versionLabel ); imagePanelOverlay.add( copyrightArea ); imagePanelOverlay.add( licenseArea ); imagePanelOverlay.setBackground( TRANSPARENT ); imagePanel.add( imagePanelOverlay ); imagePanel.setPreferredSize( new Dimension( picture.getIconWidth(), picture.getIconHeight() ) ); return imagePanel; }
Example 12
Source File: XTextAreaPeer.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public void installUI(JComponent c) { super.installUI(c); jta = (JTextArea) c; JTextArea editor = jta; UIDefaults uidefaults = XToolkit.getUIDefaults(); String prefix = getPropertyPrefix(); Font f = editor.getFont(); if ((f == null) || (f instanceof UIResource)) { editor.setFont(uidefaults.getFont(prefix + ".font")); } Color bg = editor.getBackground(); if ((bg == null) || (bg instanceof UIResource)) { editor.setBackground(uidefaults.getColor(prefix + ".background")); } Color fg = editor.getForeground(); if ((fg == null) || (fg instanceof UIResource)) { editor.setForeground(uidefaults.getColor(prefix + ".foreground")); } Color color = editor.getCaretColor(); if ((color == null) || (color instanceof UIResource)) { editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground")); } Color s = editor.getSelectionColor(); if ((s == null) || (s instanceof UIResource)) { editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground")); } Color sfg = editor.getSelectedTextColor(); if ((sfg == null) || (sfg instanceof UIResource)) { editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground")); } Color dfg = editor.getDisabledTextColor(); if ((dfg == null) || (dfg instanceof UIResource)) { editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground")); } Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight); editor.setBorder(new BorderUIResource.CompoundBorderUIResource( b,new EmptyBorder(2, 2, 2, 2))); Insets margin = editor.getMargin(); if (margin == null || margin instanceof UIResource) { editor.setMargin(uidefaults.getInsets(prefix + ".margin")); } }
Example 13
Source File: XTextAreaPeer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public void installUI(JComponent c) { super.installUI(c); jta = (JTextArea) c; JTextArea editor = jta; UIDefaults uidefaults = XToolkit.getUIDefaults(); String prefix = getPropertyPrefix(); Font f = editor.getFont(); if ((f == null) || (f instanceof UIResource)) { editor.setFont(uidefaults.getFont(prefix + ".font")); } Color bg = editor.getBackground(); if ((bg == null) || (bg instanceof UIResource)) { editor.setBackground(uidefaults.getColor(prefix + ".background")); } Color fg = editor.getForeground(); if ((fg == null) || (fg instanceof UIResource)) { editor.setForeground(uidefaults.getColor(prefix + ".foreground")); } Color color = editor.getCaretColor(); if ((color == null) || (color instanceof UIResource)) { editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground")); } Color s = editor.getSelectionColor(); if ((s == null) || (s instanceof UIResource)) { editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground")); } Color sfg = editor.getSelectedTextColor(); if ((sfg == null) || (sfg instanceof UIResource)) { editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground")); } Color dfg = editor.getDisabledTextColor(); if ((dfg == null) || (dfg instanceof UIResource)) { editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground")); } Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight); editor.setBorder(new BorderUIResource.CompoundBorderUIResource( b,new EmptyBorder(2, 2, 2, 2))); Insets margin = editor.getMargin(); if (margin == null || margin instanceof UIResource) { editor.setMargin(uidefaults.getInsets(prefix + ".margin")); } }
Example 14
Source File: DialogFrame.java From Hotel-Properties-Management-System with GNU General Public License v2.0 | 4 votes |
public DialogFrame() { setType(Type.POPUP); setResizable(false); setModalExclusionType(ModalExclusionType.APPLICATION_EXCLUDE); this.setTitle("Approving question"); this.setPreferredSize(new Dimension(400, 190)); this.setAlwaysOnTop(isAlwaysOnTopSupported()); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); getContentPane().setLayout(new BorderLayout()); final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); this.setLocation(screenSize.width / 2 - 150, screenSize.height / 2 - 75); this.setIconImage(Toolkit.getDefaultToolkit(). getImage(getClass().getResource(LOGOPATH))); final JPanel panel = new JPanel(); panel.setAutoscrolls(true); getContentPane().add(panel, BorderLayout.CENTER); panel.setLayout(null); btnYes = new JButton("YES"); btnYes.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null)); btnYes.setBounds(291, 129, 91, 29); panel.add(btnYes); btnNo = new JButton("NO"); btnNo.setBorder(new SoftBevelBorder(BevelBorder.RAISED, null, null, null, null)); btnNo.setBounds(199, 129, 91, 29); panel.add(btnNo); lblIcon = new JLabel(""); lblIcon.setIcon(new ImageIcon(DialogFrame.class.getResource("/com/coder/hms/icons/dialogPane_question.png"))); lblIcon.setBounds(14, 40, 69, 70); panel.add(lblIcon); textArea = new JTextArea(); textArea.setDisabledTextColor(new Color(153, 204, 255)); textArea.setBounds(95, 32, 287, 85); textArea.setBackground(UIManager.getColor("ComboBox.background")); textArea.setBorder(null); textArea.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); textArea.setEditable(false); textArea.setFont(new Font("Monospaced", Font.PLAIN, 14)); textArea.setLineWrap(true); panel.add(textArea); this.pack(); }
Example 15
Source File: DDChangesPanel.java From netbeans with Apache License 2.0 | 4 votes |
/** Initializes the Form */ public DDChangesPanel (String caption, final JButton processButton) { setLayout (new java.awt.BorderLayout (0, 12)); setBorder (new EmptyBorder (12, 12, 11, 0)); JTextArea text = new JTextArea (); text.setEnabled (false); text.setEditable (false); text.setDisabledTextColor (UIManager.getColor ("Label.foreground")); // NOI18N text.setBackground (UIManager.getColor ("Label.background")); // NOI18N text.setLineWrap (true); text.setWrapStyleWord (true); text.setText (caption); add (text, "North"); // NOI18N changesPanel = new JPanel (); changesPanel.setLayout (new java.awt.BorderLayout (5, 5)); JLabel changesLabel = new JLabel (); changesLabel.setText (NbBundle.getMessage (DDChangesPanel.class, "LAB_ChangesList")); changesLabel.getAccessibleContext ().setAccessibleDescription (NbBundle.getMessage (DDChangesPanel.class, "ACS_ChangesListA11yDesc")); // NOI18N changesPanel.add (changesLabel, "North"); // NOI18N jScrollPane1 = new JScrollPane (); listModel = new DefaultListModel (); changesList = new JList (listModel); changesList.setToolTipText (NbBundle.getMessage (DDChangesPanel.class, "HINT_ChangesList")); changesList.setCellRenderer (new ChangesListCellRenderer ()); changesList.addListSelectionListener (new ListSelectionListener () { public void valueChanged (ListSelectionEvent e) { processButton.setEnabled (!changesList.isSelectionEmpty ()); } }); changesLabel.setLabelFor (changesList); changesLabel.setDisplayedMnemonic (NbBundle.getMessage (DDChangesPanel.class, "LAB_ChangesList_Mnemonic").charAt (0)); getAccessibleContext().setAccessibleDescription(NbBundle.getMessage (DDChangesPanel.class, "ACS_ChangesListA11yPanelDesc")); jScrollPane1.setViewportView (changesList); changesPanel.add (jScrollPane1, "Center"); // NOI18N add (changesPanel, "Center"); // NOI18N }
Example 16
Source File: XTextAreaPeer.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 4 votes |
@Override public void installUI(JComponent c) { super.installUI(c); jta = (JTextArea) c; JTextArea editor = jta; UIDefaults uidefaults = XToolkit.getUIDefaults(); String prefix = getPropertyPrefix(); Font f = editor.getFont(); if ((f == null) || (f instanceof UIResource)) { editor.setFont(uidefaults.getFont(prefix + ".font")); } Color bg = editor.getBackground(); if ((bg == null) || (bg instanceof UIResource)) { editor.setBackground(uidefaults.getColor(prefix + ".background")); } Color fg = editor.getForeground(); if ((fg == null) || (fg instanceof UIResource)) { editor.setForeground(uidefaults.getColor(prefix + ".foreground")); } Color color = editor.getCaretColor(); if ((color == null) || (color instanceof UIResource)) { editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground")); } Color s = editor.getSelectionColor(); if ((s == null) || (s instanceof UIResource)) { editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground")); } Color sfg = editor.getSelectedTextColor(); if ((sfg == null) || (sfg instanceof UIResource)) { editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground")); } Color dfg = editor.getDisabledTextColor(); if ((dfg == null) || (dfg instanceof UIResource)) { editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground")); } Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight); editor.setBorder(new BorderUIResource.CompoundBorderUIResource( b,new EmptyBorder(2, 2, 2, 2))); Insets margin = editor.getMargin(); if (margin == null || margin instanceof UIResource) { editor.setMargin(uidefaults.getInsets(prefix + ".margin")); } }
Example 17
Source File: Util.java From netbeans with Apache License 2.0 | 4 votes |
/** * @author Marian Petras */ static void layoutSelectResourcePanel(final Container thePanel, final String instructionsText, final String selectionLabelText, final Component selectionComp, final JButton button1, final JButton button2) { JTextArea instructions = new JTextArea(); JLabel lblSelection = new JLabel(); instructions.setColumns(20); instructions.setEditable(false); instructions.setLineWrap(true); instructions.setText(instructionsText); instructions.setWrapStyleWord(true); instructions.setDisabledTextColor(new JLabel().getForeground()); instructions.setEnabled(false); instructions.setOpaque(false); lblSelection.setLabelFor(selectionComp); Mnemonics.setLocalizedText(lblSelection, selectionLabelText); JScrollPane scrollPane = new JScrollPane(selectionComp); Container filesSelection = new JPanel(); GroupLayout layout = new GroupLayout(filesSelection); filesSelection.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(LEADING) .addComponent(lblSelection) .addGroup(layout.createSequentialGroup() .addComponent(scrollPane, 0, DEFAULT_SIZE, Integer.MAX_VALUE) .addPreferredGap(RELATED) .addGroup(layout.createParallelGroup(LEADING) .addComponent(button1) .addComponent(button2))) ); layout.linkSize(SwingConstants.HORIZONTAL, button1, button2); layout.setVerticalGroup( layout.createParallelGroup(LEADING) .addGroup(layout.createSequentialGroup() .addComponent(lblSelection) .addPreferredGap(RELATED) .addGroup(layout.createParallelGroup(LEADING) .addComponent(scrollPane, 0, DEFAULT_SIZE, Integer.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addComponent(button1) .addPreferredGap(RELATED) .addComponent(button2)))) ); LayoutStyle layoutStyle = layout.getLayoutStyle(); if (layoutStyle == null) { layoutStyle = LayoutStyle.getInstance(); } BorderLayout mainLayout = new BorderLayout(); thePanel.setLayout(mainLayout); thePanel.add(instructions, BorderLayout.PAGE_START); thePanel.add(filesSelection, BorderLayout.CENTER); mainLayout.setVgap(layoutStyle.getPreferredGap(instructions, lblSelection, UNRELATED, SwingConstants.NORTH, thePanel)); }
Example 18
Source File: XTextAreaPeer.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public void installUI(JComponent c) { super.installUI(c); jta = (JTextArea) c; JTextArea editor = jta; UIDefaults uidefaults = XToolkit.getUIDefaults(); String prefix = getPropertyPrefix(); Font f = editor.getFont(); if ((f == null) || (f instanceof UIResource)) { editor.setFont(uidefaults.getFont(prefix + ".font")); } Color bg = editor.getBackground(); if ((bg == null) || (bg instanceof UIResource)) { editor.setBackground(uidefaults.getColor(prefix + ".background")); } Color fg = editor.getForeground(); if ((fg == null) || (fg instanceof UIResource)) { editor.setForeground(uidefaults.getColor(prefix + ".foreground")); } Color color = editor.getCaretColor(); if ((color == null) || (color instanceof UIResource)) { editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground")); } Color s = editor.getSelectionColor(); if ((s == null) || (s instanceof UIResource)) { editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground")); } Color sfg = editor.getSelectedTextColor(); if ((sfg == null) || (sfg instanceof UIResource)) { editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground")); } Color dfg = editor.getDisabledTextColor(); if ((dfg == null) || (dfg instanceof UIResource)) { editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground")); } Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight); editor.setBorder(new BorderUIResource.CompoundBorderUIResource( b,new EmptyBorder(2, 2, 2, 2))); Insets margin = editor.getMargin(); if (margin == null || margin instanceof UIResource) { editor.setMargin(uidefaults.getInsets(prefix + ".margin")); } }
Example 19
Source File: XTextAreaPeer.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override public void installUI(JComponent c) { super.installUI(c); jta = (JTextArea) c; JTextArea editor = jta; UIDefaults uidefaults = XToolkit.getUIDefaults(); String prefix = getPropertyPrefix(); Font f = editor.getFont(); if ((f == null) || (f instanceof UIResource)) { editor.setFont(uidefaults.getFont(prefix + ".font")); } Color bg = editor.getBackground(); if ((bg == null) || (bg instanceof UIResource)) { editor.setBackground(uidefaults.getColor(prefix + ".background")); } Color fg = editor.getForeground(); if ((fg == null) || (fg instanceof UIResource)) { editor.setForeground(uidefaults.getColor(prefix + ".foreground")); } Color color = editor.getCaretColor(); if ((color == null) || (color instanceof UIResource)) { editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground")); } Color s = editor.getSelectionColor(); if ((s == null) || (s instanceof UIResource)) { editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground")); } Color sfg = editor.getSelectedTextColor(); if ((sfg == null) || (sfg instanceof UIResource)) { editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground")); } Color dfg = editor.getDisabledTextColor(); if ((dfg == null) || (dfg instanceof UIResource)) { editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground")); } Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight); editor.setBorder(new BorderUIResource.CompoundBorderUIResource( b,new EmptyBorder(2, 2, 2, 2))); Insets margin = editor.getMargin(); if (margin == null || margin instanceof UIResource) { editor.setMargin(uidefaults.getInsets(prefix + ".margin")); } }
Example 20
Source File: XTextAreaPeer.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public void installUI(JComponent c) { super.installUI(c); jta = (JTextArea) c; JTextArea editor = jta; UIDefaults uidefaults = XToolkit.getUIDefaults(); String prefix = getPropertyPrefix(); Font f = editor.getFont(); if ((f == null) || (f instanceof UIResource)) { editor.setFont(uidefaults.getFont(prefix + ".font")); } Color bg = editor.getBackground(); if ((bg == null) || (bg instanceof UIResource)) { editor.setBackground(uidefaults.getColor(prefix + ".background")); } Color fg = editor.getForeground(); if ((fg == null) || (fg instanceof UIResource)) { editor.setForeground(uidefaults.getColor(prefix + ".foreground")); } Color color = editor.getCaretColor(); if ((color == null) || (color instanceof UIResource)) { editor.setCaretColor(uidefaults.getColor(prefix + ".caretForeground")); } Color s = editor.getSelectionColor(); if ((s == null) || (s instanceof UIResource)) { editor.setSelectionColor(uidefaults.getColor(prefix + ".selectionBackground")); } Color sfg = editor.getSelectedTextColor(); if ((sfg == null) || (sfg instanceof UIResource)) { editor.setSelectedTextColor(uidefaults.getColor(prefix + ".selectionForeground")); } Color dfg = editor.getDisabledTextColor(); if ((dfg == null) || (dfg instanceof UIResource)) { editor.setDisabledTextColor(uidefaults.getColor(prefix + ".inactiveForeground")); } Border b = new BevelBorder(false,SystemColor.controlDkShadow,SystemColor.controlLtHighlight); editor.setBorder(new BorderUIResource.CompoundBorderUIResource( b,new EmptyBorder(2, 2, 2, 2))); Insets margin = editor.getMargin(); if (margin == null || margin instanceof UIResource) { editor.setMargin(uidefaults.getInsets(prefix + ".margin")); } }