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


Java JTextArea.append方法代碼示例

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


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

示例1: ParametersController

import javax.swing.JTextArea; //導入方法依賴的package包/類
@SuppressWarnings("resource")
ParametersController(FileTable fileTable, JTextArea textArea, JProgressBar progressBar) {
	super();
	this.fileTable = fileTable;
	this.textArea = textArea;
	this.progressBar = progressBar;
	textArea.append(DeadCodeDetector.APPLICATION_NAME + '\n');
	try {
		System.setOut(new PrintStream(new TextAreaOutputStream(textArea), true, "UTF-8"));
	} catch (final UnsupportedEncodingException e) {
		// ne peut pas arriver
		throw new IllegalStateException(e);
	}
	fileChooser.setMultiSelectionEnabled(true);
	fileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
}
 
開發者ID:evernat,項目名稱:dead-code-detector,代碼行數:17,代碼來源:ParametersController.java

示例2: populateStackTrace

import javax.swing.JTextArea; //導入方法依賴的package包/類
public void populateStackTrace(JTextArea view, Throwable t)
{
	view.append(t.toString() + '\n');

	StackTraceElement[] trace = t.getStackTrace();
	for( int i = 0; i < trace.length; i++ )
	{
		view.append("\tat " + trace[i] + '\n');
	}

	Throwable ourCause = t.getCause();
	if( ourCause != null )
	{
		populateStackTraceAsCause(view, ourCause, trace);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:17,代碼來源:ExceptionDialog.java

示例3: printStack

import javax.swing.JTextArea; //導入方法依賴的package包/類
public static void printStack(Stack s,String title,JTextArea t)
{
	Stack s1 = (Stack)s.clone();
	String output = newLineStr + title + ":";
	while (!s1.empty())
	{
		Entry entry = (Entry)s1.pop();
		String str = TabConverter.revert(entry.getPart());
		output += (newLineStr + str);
		int tag = entry.getTag();
		if(tag != -1)
			str = " < " + analyser.Analyser.Tags.getString(String.valueOf(tag)) + " > ";
		else str = "";

		output += (str);
	}

	output += newLineStr + "---------------";
	t.append(output);
}
 
開發者ID:tacola-auceg,項目名稱:spellchecker_ta,代碼行數:21,代碼來源:Utils.java

示例4: initialize

import javax.swing.JTextArea; //導入方法依賴的package包/類
private void initialize() {
	txtArea = new JTextArea();
	txtArea.setFont(new Font(Font.SANS_SERIF, 0, 12));
	txtArea.setEditable(false);
	JScrollPane sp = new JScrollPane(txtArea);
	sp.setBounds(5, 5, 600, 410);
	frame.getContentPane().add(sp);
	
	btnOk = new JButton("OK");
	btnOk.setFont(new Font(Font.SANS_SERIF, 0, 12));
	btnOk.setBounds(510, 420, 95, 20);
	btnOk.addActionListener(new ActionListener() {
		public void actionPerformed(ActionEvent e) {
			frame.dispose();
		}
	});
	frame.getContentPane().add(btnOk);
	
	txtArea.append(new Utils().getLicenseFile());
	txtArea.setCaretPosition(0);
}
 
開發者ID:JudgeGlass,項目名稱:Install_Builder_Universal,代碼行數:22,代碼來源:GNULicenseWindow.java

示例5: populateStackTraceAsCause

import javax.swing.JTextArea; //導入方法依賴的package包/類
private void populateStackTraceAsCause(JTextArea view, Throwable t, StackTraceElement[] causedTrace)
{
	StackTraceElement[] trace = t.getStackTrace();
	int m = trace.length - 1;
	int n = causedTrace.length - 1;

	while( m >= 0 && n >= 0 && trace[m].equals(causedTrace[n]) )
	{
		m--;
		n--;
	}
	int framesInCommon = trace.length - 1 - m;

	view.append("Caused by: " + t.toString() + '\n');
	for( int i = 0; i <= m; i++ )
	{
		view.append("\tat " + trace[i] + '\n');
	}

	if( framesInCommon != 0 )
	{
		view.append("\t... " + framesInCommon + " more\n");
	}

	// Recurse if we have a cause
	Throwable ourCause = t.getCause();
	if( ourCause != null )
	{
		populateStackTraceAsCause(view, ourCause, trace);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:32,代碼來源:ExceptionDialog.java

示例6: ErrorsDialog

import javax.swing.JTextArea; //導入方法依賴的package包/類
public ErrorsDialog(ArrayList<String> errors) {
	okButton = new JButton("Ok");
	errorsTextArea = new JTextArea();
	
	setLayout(new BorderLayout());
	okButton.addActionListener(new OkButtonListener());
	errorsTextArea.setEditable(false);
	
	// Showing errors
	for (int i = 0; i < errors.size(); i++) {
		errorsTextArea.append(" - " + errors.get(i) + "\n");
	}
	
	JPanel mainContainer = new JPanel(new BorderLayout());
	JPanel messagePanel = new JPanel();
	JPanel buttonsPanel = new JPanel();
	messagePanel.add(new JLabel(MESSAGE));
	JScrollPane errorsPanelSP = new JScrollPane(errorsTextArea);
	errorsPanelSP.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
	errorsPanelSP.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
	
	mainContainer.setBorder(BorderFactory.createEmptyBorder(PADDING_TOP, 
			PADDING_LEFT, PADDING_BOTTOM, PADDING_RIGHT));
	
	buttonsPanel.add(okButton);
	mainContainer.add(messagePanel, BorderLayout.NORTH);
	mainContainer.add(errorsPanelSP, BorderLayout.CENTER);
	mainContainer.add(buttonsPanel, BorderLayout.SOUTH);
	
	add(mainContainer);
	buildWindow();
}
 
開發者ID:tteguayco,項目名稱:JITRAX,代碼行數:33,代碼來源:ErrorsDialog.java

示例7: setKunde

import javax.swing.JTextArea; //導入方法依賴的package包/類
/**
 * Setzt den Kunden, dessen Details angezeigt werden sollen.
 * 
 * @param kunde Ein Kunde, oder null um die Detailanzeige zu leeren.
 * 
 */
public void setKunde(Kunde kunde)
{
    JTextArea selectedKundenTextArea = _ui.getKundenAnzeigerTextArea();
    selectedKundenTextArea.setText("");
    if (kunde != null)
    {
        selectedKundenTextArea.append(kunde.getFormatiertenString());
    }
}
 
開發者ID:polemonium,項目名稱:SE2Project,代碼行數:16,代碼來源:KundenDetailAnzeigerWerkzeug.java

示例8: zeigeAusgewaehlteVerleihkarten

import javax.swing.JTextArea; //導入方法依賴的package包/類
/**
 * Zeigt die Details der ausgewählten Verleihkarten an.
 */
private void zeigeAusgewaehlteVerleihkarten()
{
    List<Verleihkarte> selektierteVerleihkarten = getSelectedVerleihkarten();
    JTextArea _ausgewaehlteVerleihkartenTextArea = _rueckgabeUI
        .getVerleihkartenAnzeigerTextArea();
    _ausgewaehlteVerleihkartenTextArea.setText("");
    for (Verleihkarte verleihkarte : selektierteVerleihkarten)
    {
        _ausgewaehlteVerleihkartenTextArea
            .append(verleihkarte.getFormatiertenString());
        _ausgewaehlteVerleihkartenTextArea.append("--------------- \n");
    }
}
 
開發者ID:polemonium,項目名稱:SE2Project,代碼行數:17,代碼來源:RueckgabeWerkzeug.java

示例9: showDialog

import javax.swing.JTextArea; //導入方法依賴的package包/類
public static void showDialog(Component parent, List<LogParser.ParseError> errors) {
    JTextArea txaErrors = new JTextArea();
    
    for (LogParser.ParseError error : errors) {
        txaErrors.append("Error at line " + error.getLineNumber());
        txaErrors.append(": " + error.getMessage());
        txaErrors.append("\n");
        txaErrors.append("Log line: " + error.getLine());
        txaErrors.append("\n");
    }
    
    JScrollPane scpErrors = new JScrollPane(txaErrors);
    
    JOptionPane.showMessageDialog(parent, scpErrors, "Parse errors", JOptionPane.ERROR_MESSAGE);
}
 
開發者ID:arodchen,項目名稱:MaxSim,代碼行數:16,代碼來源:ImportLogErrorDialog.java

示例10: LicenseDialog

import javax.swing.JTextArea; //導入方法依賴的package包/類
/**
 * Constructor
 */
public LicenseDialog(final Window parent) {
	super(parent, Resources.getLabel("license.button"), ModalityType.APPLICATION_MODAL);
	getContentPane().add(createHeaderPanel(false, null), BorderLayout.NORTH);
	final JTextArea license = new JTextArea(30, 50);
	license.setEditable(false);
	// read the license file and add its content to the JTextArea
	for (final String line : Util.readUTF8File(Resources.class.getResourceAsStream("/" + Resources.RESOURCE_PATH + "/License.txt"))) {
		license.append("   " + line + "\n");
	}
	// scroll to the top of the JTextArea
	license.setCaretPosition(0);
	// the all thing in a ScrollPane
	final JScrollPane scroll = new JScrollPane(license);
	getContentPane().add(scroll, BorderLayout.CENTER);
	final JPanel donatePanel = new JPanel(new BorderLayout(5, 10));
	final JLabel donate = new JLabel(Resources.getLabel("donate"));
	donatePanel.add(donate, BorderLayout.NORTH);
	final JPanel center = new JPanel();
	center.setLayout(new FlowLayout());
	center.add(new JLabel(Resources.getImageIcon("donate.png")));
	center.add(new HyperlinkLabel(Resources.getLabel("donate.label"), Env.INSTANCE.getDonateUrl()));
	donatePanel.add(center, BorderLayout.CENTER);
	final JButton close = new JButton(Resources.getLabel("close.button"));
	close.addActionListener(e -> LicenseDialog.this.dispose());
	donatePanel.add(close, BorderLayout.SOUTH);
	getContentPane().add(donatePanel, BorderLayout.SOUTH);
	SwingUtilities4.setUp(this);
	getRootPane().registerKeyboardAction(e -> dispose(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
}
 
開發者ID:leolewis,項目名稱:openvisualtraceroute,代碼行數:33,代碼來源:LicenseDialog.java

示例11: fileDetails

import javax.swing.JTextArea; //導入方法依賴的package包/類
public void fileDetails(String[] fileAtt2){
	final String newline = "\n";
	JTextArea text = new JTextArea(15,100);
	text.setLineWrap(true);

	if(fileAtt2==null){
		String messageNan = "No file details available.\n";
		text.append(messageNan);
	} else {
	/* Goes through the attributes and prints each row on newline.
	 * If line contains extra quotes,tab,newline strips that out.
	 * Rules wont apply in a textarea.
	 */
	for(int p =0; p<fileAtt2.length; p++) {
		String attributeItem=fileAtt2[p];
		attributeItem=attributeItem.replace("\"", "");
		attributeItem=attributeItem.replace("\\t", "");
		if(attributeItem.contains("\\n")) {
			attributeItem=attributeItem.replace("\\n", "SC123");
			String[] itemsArray = attributeItem.split("SC123");
			String itemFormat = itemsArray[0];
			for(int q=1; q<itemsArray.length; q++) {
				itemFormat += " " + itemsArray[q];
			}
			attributeItem=itemFormat;
		}
		text.append(attributeItem + newline);
	}
}
	text.setEditable(false);
	JScrollPane scroll = new JScrollPane(text);
	scroll.setPreferredSize(new Dimension(350, 200));
	//JOptionPane.showMessageDialog(null, scroll); // with JTextArea
	JOptionPane.showMessageDialog(null, scroll, "File Details", JOptionPane.DEFAULT_OPTION);
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:36,代碼來源:ProjectionDialog.java

示例12: readAsH77

import javax.swing.JTextArea; //導入方法依賴的package包/類
public void readAsH77 (JTextArea text, File h77File) throws IOException {
	BufferedReader in = new BufferedReader(new InputStreamReader( new FileInputStream(h77File)));
	text.append( in.readLine() );
	String s;
	while( (s=in.readLine())!=null ) {
		text.append("\n"+s);
	}
	in.close();
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:10,代碼來源:MGGDataDisplay.java

示例13: readAsH77T

import javax.swing.JTextArea; //導入方法依賴的package包/類
public void readAsH77T (JTextArea text, File h77File) throws IOException {
	BufferedReader in = new BufferedReader(new InputStreamReader( new FileInputStream(h77File)));
	// read in each line and split into fields
	ArrayList<String[]> lines = new ArrayList<String[]>();
	String l;
	while( ( l=in.readLine())!=null ) {
		lines.add(l.split("\t"));
	}
	// if file has a header line, containing field names, use that, else use convention values
	// by convention we can detect this if the second field name is "FORMAT_77"
	if (!lines.get(0)[1].equals("FORMAT_77")) {
		lines.add(0,  CONVENTION_M77T_LABELS);
	}
				
	int numFields = lines.get(0).length;

	for (int i=0; i < numFields; i++) {

		for (int j=0; j<lines.size(); j++) {
			String[] line = lines.get(j);
			if (j == 0) {
				text.append(line[i] + ":\t");
			} else if (line.length > i) text.append(line[i] + "\t");
		}
		text.append("\n");
	}
	in.close();
}
 
開發者ID:iedadata,項目名稱:geomapapp,代碼行數:29,代碼來源:MGGDataDisplay.java

示例14: processResults

import javax.swing.JTextArea; //導入方法依賴的package包/類
/**
 * Pretty print the results of the query in the output panel
 */
private void processResults(QueryResult queryResult) {
    try {
        getUserOutput().flush();
    } catch (IOException e) {
        // ignore
    }
    JTextArea results = getResultsArea();
    if (!results.getText().endsWith("\n")) {
        results.append("\n");
    }
    if (queryResult == null) {
        results.append("No\n");
        getNextResultAction().setEnabled(false);
    } else {
        switch (queryResult.getReturnValue()) {
        case SUCCESS:
        case SUCCESS_LAST:
            this.solutionCount++;
            for (Entry<String,Object> entry : queryResult.getVariables().entrySet()) {
                results.append(entry.getKey());
                results.append(" = ");
                if (entry.getValue() instanceof Term) {
                    results.append(TermWriter.toString((Term) entry.getValue()));
                } else {
                    results.append("" + entry.getValue());
                }
                results.append("\n");
            }
            results.append("Yes\n");
            getNextResultAction().setEnabled(true);
            break;
        case FAIL:
            results.append("No\n");
            getNextResultAction().setEnabled(false);
            break;
        case HALT:
            results.append("Interpreter was halted\n");
            break;
        default:
            results.append(String.format("Unexpected return value: %s",
                getEngine().lastReturnValue().toString()));
        }
        this.resultsStatus.setText(String.format("%d solution(s); Executed in %fms",
            this.solutionCount,
            queryResult.getExecutionTime() / 1000000.0));
    }
}
 
開發者ID:meteoorkip,項目名稱:JavaGraph,代碼行數:51,代碼來源:PrologDisplay.java

示例15: showReport

import javax.swing.JTextArea; //導入方法依賴的package包/類
/**
 *  Shows a message dialog with the unpacked/overriden files.
 * 
 * @param pluginWorkspaceAccess  Entry point for accessing the DITA Maps area.
 * @param list  The relative paths of the unzipped files.
 * @throws IOException  Problems reading the files.
 */
private void showReport(final StandalonePluginWorkspace pluginWorkspaceAccess,
    ArrayList<String> list) throws IOException {
  final PluginResourceBundle resourceBundle = pluginWorkspaceAccess.getResourceBundle();

  // Present a log with the overridden files.
  if(list != null && !list.isEmpty()){
    JTextArea text = new JTextArea(10, 40);

    // Iterate with an index and put a new line
    //    for all lines except the first one. 
    text.append(list.get(0));
    for(int i = 1; i < list.size(); i++){
      text.append("\n");
      text.append(list.get(i));
    }
    text.setLineWrap(true);
    text.setWrapStyleWord(true);
    text.setEditable(false);

    JScrollPane scroll = new JScrollPane(text);
    scroll.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);

    JPanel panel = new JPanel(new GridBagLayout());

    GridBagConstraints gbcLabel = new GridBagConstraints();
    gbcLabel.gridx = 0;
    gbcLabel.gridy = 0;
    gbcLabel.gridwidth = 1;
    gbcLabel.gridheight = 1;
    gbcLabel.weightx = 0;
    gbcLabel.weighty = 0;
    gbcLabel.fill = GridBagConstraints.HORIZONTAL;
    gbcLabel.anchor = GridBagConstraints.NORTH;

    panel.add(new JLabel(resourceBundle.getMessage(Tags.SHOW_REPORT_LABEL)), gbcLabel);

    GridBagConstraints gbcScroll = new GridBagConstraints();
    gbcScroll.gridx = 0;
    gbcScroll.gridy = 1;
    gbcScroll.gridwidth = 1;
    gbcScroll.gridheight = 1;
    gbcScroll.weightx = 0;
    gbcScroll.weighty = 0;
    gbcScroll.fill = GridBagConstraints.BOTH;
    gbcScroll.anchor = GridBagConstraints.LINE_START;
    panel.add(scroll , gbcScroll);


    JOptionPane.showMessageDialog((JFrame) pluginWorkspaceAccess.getParentFrame(), panel, resourceBundle.getMessage(Tags.SHOW_REPORT_TITLE), JOptionPane.INFORMATION_MESSAGE);
  }
  else{
    throw new IOException(resourceBundle.getMessage(Tags.SHOW_REPORT_EXCEPTION_MESSAGE));
  }
}
 
開發者ID:oxygenxml,項目名稱:oxygen-dita-translation-package-builder,代碼行數:62,代碼來源:TranslationPackageBuilderExtension.java


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