當前位置: 首頁>>代碼示例>>Java>>正文


Java TextArea.setBackground方法代碼示例

本文整理匯總了Java中java.awt.TextArea.setBackground方法的典型用法代碼示例。如果您正苦於以下問題:Java TextArea.setBackground方法的具體用法?Java TextArea.setBackground怎麽用?Java TextArea.setBackground使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.TextArea的用法示例。


在下文中一共展示了TextArea.setBackground方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: actionPerformed

import java.awt.TextArea; //導入方法依賴的package包/類
public void actionPerformed() {
    JFrame f = new JFrame();
    TextArea textArea = new TextArea();
    textArea.setEditable(false);
    textArea.setBackground(Color.white);
    textArea.setForeground(Color.black);
    IData data = accumulatorHistory.getData();
    IData xData = ((DataInfoFunction)accumulatorHistory.getDataInfo()).getXDataSource().getIndependentData(0);
    for (int i=0; i<data.getLength(); i++) {
        double x = xData.getValue(i);
        double y = data.getValue(i);
        if (Double.isNaN(x) || Double.isNaN(y)) continue;
        textArea.append(x+"\t"+y+"\n");
    }
    f.add(textArea);
    f.pack();
    f.setSize(400,600);
    f.setVisible(true);
}
 
開發者ID:etomica,項目名稱:etomica,代碼行數:20,代碼來源:ActionHistoryWindow.java

示例2: actionPerformed

import java.awt.TextArea; //導入方法依賴的package包/類
public void actionPerformed() {
    JFrame f = new JFrame();
    TextArea textArea = new TextArea();
    textArea.setEditable(false);
    textArea.setBackground(Color.white);
    textArea.setForeground(Color.black);
    int nLeaf = leafList.getAtomCount();
    for (int iLeaf=0; iLeaf<nLeaf; iLeaf++) {
        IAtom a = leafList.getAtom(iLeaf);
        Vector pos = a.getPosition();
        String str = Double.toString(pos.getX(0));
        for (int i=1; i<pos.getD(); i++) {
            str += " "+Double.toString(pos.getX(i));
        }
        textArea.append(str+"\n");
    }
    f.add(textArea);
    f.pack();
    f.setSize(400,600);
    f.setVisible(true);
}
 
開發者ID:etomica,項目名稱:etomica,代碼行數:22,代碼來源:ActionConfigWindow.java

示例3: actionPerformed

import java.awt.TextArea; //導入方法依賴的package包/類
public void actionPerformed() {
    JFrame f = new JFrame();
    TextArea textArea = new TextArea();
    textArea.setEditable(false);
    textArea.setBackground(Color.white);
    textArea.setForeground(Color.black);
    int nLeaf = leafList.getAtomCount();
    for (int iLeaf=0; iLeaf<nLeaf; iLeaf++) {
        IAtomKinetic a = (IAtomKinetic)leafList.getAtom(iLeaf);
        Vector vel = a.getVelocity();
        String str = Double.toString(vel.getX(0));
        for (int i=1; i<vel.getD(); i++) {
            str += " "+Double.toString(vel.getX(i));
        }
        textArea.append(str+"\n");
    }
    f.add(textArea);
    f.pack();
    f.setSize(400,600);
    f.setVisible(true);
}
 
開發者ID:etomica,項目名稱:etomica,代碼行數:22,代碼來源:ActionVelocityWindow.java

示例4: makeGraphicsPanel

import java.awt.TextArea; //導入方法依賴的package包/類
public void makeGraphicsPanel() {
    	graphicPanel = new JPanel();
    	graphicPanel.setLayout(gbLayout);
    	
    	graphicOut2 = new JPanel();
    	graphicOut2.setLayout(new GridLayout(0,(int)((myPanel.getWidth()-60)/100.0),0,0));
        graphicOut2.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED, Color.black, Color.gray)));	   
        graphicOut = new JScrollPane();
//        graphicOut2.addMouseListener(new MouseEventClusterPanel());
        graphicOut.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED, Color.black, Color.gray)));	   

        graphicOut2.setPreferredSize(null);
        graphicOut.setBackground(null);
        graphicOut2.setBackground(null);
        graphicOut.getViewport().setPreferredSize(null);
        graphicOut.getViewport().setBackground(Color.white);
        graphicOut.getViewport().add(graphicOut2);
        gbConst.weightx = 1; gbConst.weighty = 1;
        gbConst.fill = GridBagConstraints.BOTH;
        addComponent(graphicOut,graphicPanel, 0,0,4,1);

        JPanel tmp = new JPanel();
        textAreaForBonds = new TextArea("Bonds of Selected Cluster :", 4, 65);
        textAreaForBonds.append("\n\n");
        textAreaForBonds.append("Weight of Selected Cluster : ");
        textAreaForBonds.setBackground(Color.white);
        textAreaForBonds.setEditable(false);
        tmp.add(textAreaForBonds);
        gbConst.weightx = 0; gbConst.weighty = 0;
        gbConst.fill = GridBagConstraints.BOTH;
        addComponent(tmp,graphicPanel, 1,0,3,1);

        JPanel textPanel = new JPanel(new GridLayout(2,0));
        textPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED, Color.black, Color.gray)));
        JTextField  jtf = new JTextField();
        jtf.setBackground(Color.lightGray);
        jtf.setText("Total Number of Cluster");
        jtf.setEditable(false);
        textPanel.add(jtf);
        totalNCluster = new JTextField();
        textPanel.add(totalNCluster);
        gbConst.weightx = 0; gbConst.weighty = 0;
        gbConst.fill = GridBagConstraints.BOTH;
        addComponent(textPanel,graphicPanel, 1,3,1,1);
        
        if(firstTimeDrawn) {
        	displayPanel.add("Cluster Diagram Graphics", graphicPanel); firstTimeDrawn= false;        
        } else {
        	displayPanel.remove(0);displayPanel.add(graphicPanel, "Cluster Diagram Graphics",  0);
        }
    }
 
開發者ID:etomica,項目名稱:etomica,代碼行數:52,代碼來源:MyApplet.java

示例5: createInstructionUI

import java.awt.TextArea; //導入方法依賴的package包/類
private void createInstructionUI() {
    mainFrame = new Frame("Updating TrayIcon Popup Menu Item Test");
    layout = new GridBagLayout();
    mainControlPanel = new Panel(layout);
    resultButtonPanel = new Panel(layout);

    GridBagConstraints gbc = new GridBagConstraints();
    String instructions
            = "INSTRUCTIONS:"
            + "\n   1. Click on the System Tray Icon"
            + "\n   2. Click on any of the displayed Menu items"
            + "\n   3. Repeat step 1 and count the number of items in the "
            + "Menu"
            + "\n   4. The number of items in the Menu should increase by 1"
            + "\n   5. Repeating steps 1, 2 and 3 should not break 4th step"
            + "\n   6. Click Fail if the 4th step is broken, Otherwise "
            + "click Pass ";

    instructionTextArea = new TextArea();
    instructionTextArea.setText(instructions);
    instructionTextArea.setEnabled(false);
    instructionTextArea.setBackground(Color.white);

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainControlPanel.add(instructionTextArea, gbc);

    passButton = new Button("Pass");
    passButton.setName("Pass");
    passButton.addActionListener(this);

    failButton = new Button("Fail");
    failButton.setName("Fail");
    failButton.addActionListener(this);

    gbc.gridx = 0;
    gbc.gridy = 0;
    resultButtonPanel.add(passButton, gbc);
    gbc.gridx = 1;
    gbc.gridy = 0;
    resultButtonPanel.add(failButton, gbc);
    gbc.gridx = 0;
    gbc.gridy = 1;
    mainControlPanel.add(resultButtonPanel, gbc);

    mainFrame.add(mainControlPanel);
    mainFrame.pack();
    mainFrame.setVisible(true);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:51,代碼來源:UpdatePopupMenu.java

示例6: createInstructionUI

import java.awt.TextArea; //導入方法依賴的package包/類
private void createInstructionUI() {
    instructionFrame = new Frame("Native Print Dialog and Page Dialog");
    layout = new GridBagLayout();
    mainControlPanel = new Panel(layout);
    resultButtonPanel = new Panel(layout);

    GridBagConstraints gbc = new GridBagConstraints();
    String instructions
            = "\nINSTRUCTIONS:\n"
            + "\n   1. Click on the 'show a native print dialog' button. A "
            + "native print dialog will come up."
            + "\n   2. Click on the 'Cancel' button on Mac OS X or "
            + "'close'(X) on other paltforms. Dialog will be closed."
            + "\n   3. After the dialog is closed another window should "
            + "become the active window."
            + "\n   4. If there no any active window then the test has "
            + "failed. Click on 'Fail' Button."
            + "\n   5. Click on the 'show a native page dialog' button. A "
            + "native page dialog will come up."
            + "\n   6. Click on the 'Cancel' button on Mac OS X or "
            + "'close'(X) on other paltforms. Dialog will be closed."
            + "\n   7. After the dialog is closed another window should "
            + "become the active window."
            + "\n   8. If there no any active window then the test has "
            + "failed. Click on 'Fail' Button."
            + "\n   9. Test Passed. Click on 'Pass' Button.";

    instructionTextArea = new TextArea(13, 80);
    instructionTextArea.setText(instructions);
    instructionTextArea.setEnabled(false);
    instructionTextArea.setBackground(Color.white);

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 0.5;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainControlPanel.add(instructionTextArea, gbc);

    passButton = new Button("Pass");
    passButton.setName("Pass");
    passButton.addActionListener((ActionListener) this);

    failButton = new Button("Fail");
    failButton.setName("Fail");
    failButton.addActionListener((ActionListener) this);

    setButtonEnable(false);

    gbc.gridx = 0;
    gbc.gridy = 0;
    resultButtonPanel.add(passButton, gbc);
    gbc.gridx = 1;
    gbc.gridy = 0;
    resultButtonPanel.add(failButton, gbc);
    gbc.gridx = 0;
    gbc.gridy = 1;
    mainControlPanel.add(resultButtonPanel, gbc);

    instructionFrame.add(mainControlPanel);
    instructionFrame.pack();
    instructionFrame.setVisible(true);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:63,代碼來源:RestoreActiveWindowTest.java

示例7: createInstructionUI

import java.awt.TextArea; //導入方法依賴的package包/類
private void createInstructionUI() {
    mainFrame = new Frame("Drag and drop link from web browser");
    layout = new GridBagLayout();
    mainControlPanel = new Panel(layout);
    resultButtonPanel = new Panel(layout);

    GridBagConstraints gbc = new GridBagConstraints();
    String instructions
            = "INSTRUCTIONS:"
            + "\n   1. Open any browser."
            + "\n   2. Select and drag URL from the browser page and "
            + "drop it on the panel"
            + "\n   3. If test fails, then a popup message will be displayed,"
            + " click Ok and \n       click Fail button."
            + "\n   5. Otherwise test passed. Click Pass button.";

    instructionTextArea = new TextArea();
    instructionTextArea.setText(instructions);
    instructionTextArea.setEnabled(false);
    instructionTextArea.setBackground(Color.white);

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainControlPanel.add(instructionTextArea, gbc);

    passButton = new Button("Pass");
    passButton.setName("Pass");
    passButton.addActionListener(this);

    failButton = new Button("Fail");
    failButton.setName("Fail");
    failButton.addActionListener(this);

    gbc.gridx = 0;
    gbc.gridy = 0;
    resultButtonPanel.add(passButton, gbc);
    gbc.gridx = 1;
    gbc.gridy = 0;
    resultButtonPanel.add(failButton, gbc);
    gbc.gridx = 0;
    gbc.gridy = 1;
    mainControlPanel.add(resultButtonPanel, gbc);

    mainFrame.add(mainControlPanel);
    mainFrame.pack();
    mainFrame.setVisible(true);
}
 
開發者ID:AdoptOpenJDK,項目名稱:openjdk-jdk10,代碼行數:49,代碼來源:DragLinkFromBrowser.java


注:本文中的java.awt.TextArea.setBackground方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。