Java 8 TextComponent - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 TextComponent class.

This code example shows how to use the following methods:setFont, setForeground, setEditable, setText
This code example shows how to use the following methods:setFont, setEditable, setText
import java.awt.event.ActionListener;
 
 
 
public class MessageDialog extends Dialog implements ActionListener {
    private final TextArea    text=new TextArea("");
    private final Font  default_font=new Font("Helvetica",Font.PLAIN,12);
     
 
    public MessageDialog(Frame parent, String sender, String msg) {
	super(parent, "Msg from " + sender);
 
	Button ok=new Button("OK");
 
	setLayout(new BorderLayout());
	setBackground(Color.white);
 
	ok.setFont(default_font);
	text.setFont(default_font);
	text.setEditable(false);

6
CodeRank
This code example shows how to use the following methods:setFont, setEditable
      c.weighty = 1.0;
      c.fill = GridBagConstraints.BOTH;
      c.gridx=0; c.gridy=2;
      c.gridwidth=GridBagConstraints.REMAINDER; c.gridheight=1;
      c.anchor=GridBagConstraints.NORTHWEST;
      output_textarea = new TextArea("",10,50);
      output_textarea.setFont(new Font("Monospaced",Font.PLAIN,11));
      output_textarea.setEditable(false);
      //output_textarea.setEnabled(false); 
      container.add(output_textarea,c);
 
   }//end guiInit 
 
 
// WindowListener Interface 
///////////////////////////////// 
   @Override 
public void windowActivated(java.awt.event.WindowEvent e){
   } 
   @Override 
6
CodeRank
This code example shows how to use the following methods:setFocusable, setFont, setEditable, setText
This code example shows how to use the following methods:setBackground, addActionListener, setEchoChar
   public Dimension getPreferredSize(){ return getMinimumSize() ; }
   private class LoginPanel extends Panel implements ActionListener {
      private static final long serialVersionUID = -5700444988956707265L;
      private String    _password     = "" ;
      private TextField _loginText    = new TextField("") ;
      private TextField _passwordText = new TextField("") ;
      public LoginPanel(){ 
         KeyValueLayout kvl = new KeyValueLayout() ;
         kvl.setHgap( 10 ) ;
         kvl.setVgap( 10 ) ;
         setLayout( kvl ) ;
         Label login     = new Label( "Login" ) ;
         Label password  = new Label( "Password" ) ;
 
         login.setFont( _standardFont ) ;
         password.setFont( _standardFont ) ;
 
 
         _loginText.setBackground( Color.white ) ;
         _passwordText.setBackground( Color.white ) ;

5
CodeRank
This code example shows how to use the following methods:addKeyListener, requestFocus, setFont, setText
        if (defScript != null) {
            if (defDirectory != null) {
                defScript = defDirectory + File.separator + defScript;
            } 
 
            txtCommand.setText(DatabaseManagerCommon.readFile(defScript));
        } 
 
        txtCommand.requestFocus();
    } 
 
    void addMenu(MenuBar b, String name, String[] items) {
 
        /* It's a very poor design to encapsulate menu creation this way. 
         * Can't customize the menus this way (e.g. shortcut keys, 
         * mnemonics, disabling, etc. */ 
        Menu menu = new Menu(name);
 
        if (name.equals("Tools") && !TT_AVAILABLE) {
 

5
CodeRank
This code example shows how to use the following methods:setFont, setBackground
      _topLabel.setFont( _bigFont ) ;
      add( _topLabel , "North" ) ;
      _updateButton = new Button( "Update Routing" ) ;
      _updateButton.addActionListener( this ) ;
      add( _updateButton , "South" ) ;
      _routeText = new TextArea() ;
      _routeText.setFont( _textFont ) ;
      if( _useColor ) {
          _routeText.setBackground(Color.magenta);
      } 
      add( _routeText , "Center" ) ;
   } 
   @Override 
   public Insets getInsets(){ return new Insets( 20 , 20 ,20 , 20 ) ; }
   public void showDomain( CellDomainNode domainNode ){
      _topLabel.setText( " Routing Table of "+domainNode.getName()) ;
      _domainNode = domainNode ;
      updateDomain() ; 
   } 
   private void updateDomain(){ 
5
CodeRank
This code example shows how to use the following methods:getText
         Debug.info("[TextPropertyEditor] User pressed ENTER");
          
         if (getTargetComponent() instanceof SikuliGuideText) 
            ((SikuliGuideText) getTargetComponent()).setText(textField.getText());
         else if (getTargetComponent() instanceof SikuliGuideFlag) 
            ((SikuliGuideFlag) getTargetComponent()).setText(textField.getText());
          
         setVisible(false);      
                   
      }else if (k.getKeyCode() == KeyEvent.VK_ESCAPE){
          
         Debug.info("[TextPropertyEditor] User pressed ESCAPE");
          
         setVisible(false); 
          
      } 
   } 
    
 
    
7
CodeRank
This code example shows how to use the following methods:addCaretListener, getText, setText
 
  /** the label for the URL. */ 
  protected JLabel m_LabelURL = new JLabel("URL ");
 
  /** the textfield for the URL. */ 
  protected JTextField m_TextURL = new JTextField(40);
 
  /** the button for the DB-Dialog. */ 
  protected JButton m_ButtonDatabase = new JButton("User...");
 
  /** the button for connecting to the database. */ 
  protected JButton m_ButtonConnect = new JButton("Connect");
 
  /** the button for the history. */ 
  protected JButton m_ButtonHistory = new JButton("History...");
 
  /** the connection listeners. */ 
  protected HashSet m_ConnectionListeners;
 
  /** the history listeners. */ 

7
CodeRank
This code example shows how to use the following methods:setLineWrap, setWrapStyleWord, setCaretPosition, setEditable
     * @return a panel. 
     */ 
    private JPanel createLicencePanel() {
 
        final JPanel licencePanel = new JPanel(new BorderLayout());
        final JTextArea area = new JTextArea(this.licence);
        area.setLineWrap(true);
        area.setWrapStyleWord(true);
        area.setCaretPosition(0);
        area.setEditable(false);
        licencePanel.add(new JScrollPane(area));
        return licencePanel;
 
    } 
 
 
} 
7
CodeRank
See Code Examples for Java 8 TextComponent Methods: