当前位置: 首页>>代码示例>>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;未经允许,请勿转载。