Note that there are some explanatory texts on larger screens.

plurals
  1. POput system.out.print in frame java [netbeans]
    text
    copied!<p>first im newbie and not good in english<br> is it possible to put system.out.print in frame? let's say if i want to see all my output print in textfield or something like that. i can put output print in textfield but it just settext one process. i want all log of my output in textfield, not just one output.<br> sorry if it dummy question,thanks for your answer before<br> i have code and i want to put all my output in text2(textfield)</p> <pre><code> this is my whole code: import java.io.IOException; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.JTextPane; import javax.swing.text.BadLocationException; import javax.swing.text.Document; import org.jpos.iso.BaseChannel; import org.jpos.iso.ISOException; import org.jpos.iso.ISOMsg; import org.jpos.iso.ISOPackager; import org.jpos.iso.ISORequestListener; import org.jpos.iso.ISOServer; import org.jpos.iso.ISOSource; import org.jpos.iso.ServerChannel; import org.jpos.iso.channel.ASCIIChannel; import org.jpos.iso.packager.GenericPackager; import jpos.JPosServer; public class server extends javax.swing.JFrame { public server() { initComponents(); } @SuppressWarnings("unchecked") // &lt;editor-fold defaultstate="collapsed" desc="Generated Code"&gt; private void initComponents() { mulai = new javax.swing.JButton(); text = new javax.swing.JScrollPane(); text1 = new javax.swing.JTextArea(); jScrollPane1 = new javax.swing.JScrollPane(); JTextPane = new javax.swing.JTextPane(); setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout()); mulai.setText("Star Server"); mulai.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { mulaiActionPerformed(evt); } }); getContentPane().add(mulai, new org.netbeans.lib.awtextra.AbsoluteConstraints(129, 66, -1, -1)); text1.setColumns(20); text1.setRows(5); text.setViewportView(text1); getContentPane().add(text, new org.netbeans.lib.awtextra.AbsoluteConstraints(16, 96, 350, 130)); jScrollPane1.setViewportView(JTextPane); getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(50, 250, 330, 170)); pack(); }// &lt;/editor-fold&gt; private void log(String msg) { JTextPane guiConsole = new JTextPane(); Document doc = guiConsole.getDocument(); try { doc.insertString(doc.getLength(), msg + "\r\n", null); } catch (BadLocationException e) {} } private void setText2Text(String msg) { String toAppend = text1.getText(); toAppend = toAppend + "/n" + msg; text1.setText(toAppend); } private void mulaiActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: } public boolean process1(ISOSource isoSrc, ISOMsg isoMsg) { try { log("Server menerima koneksi dari ["+((BaseChannel)isoSrc).getSocket().getInetAddress().getHostAddress()+"]"); if (isoMsg.getMTI().equalsIgnoreCase("1800")) { acceptNetworkMsg(isoSrc, isoMsg); } } catch (IOException ex) { Logger.getLogger(JPosServer.class.getName()).log(Level.SEVERE, null, ex); } catch (ISOException ex) { Logger.getLogger(JPosServer.class.getName()).log(Level.SEVERE, null, ex); } return false; } private void acceptNetworkMsg(ISOSource isoSrc, ISOMsg isoMsg) throws ISOException, IOException { log("Accepting Network Management Request"); ISOMsg reply = (ISOMsg) isoMsg.clone(); reply.setMTI("1810"); reply.set(39, "00"); isoSrc.send(reply); } /** * @param args the command line arguments */ public static void main(String args[]) throws ISOException { String hostname = "localhost"; int portNumber = 1234; // membuat sebuah packager ISOPackager packager = new GenericPackager("src/jpos/iso93ascii.xml"); // membuat channel ServerChannel channel = new ASCIIChannel(hostname, portNumber, packager); // membuat server ISOServer server = new ISOServer(portNumber, channel, null); server.addISORequestListener(new JPosServer()); new Thread(server).start(); System.out.println("Server siap menerima koneksi pada port [" + portNumber+"]"); /* Set the Nimbus look and feel */ //&lt;editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) "&gt; /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel. * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html */ try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException ex) { java.util.logging.Logger.getLogger(server.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (InstantiationException ex) { java.util.logging.Logger.getLogger(server.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (IllegalAccessException ex) { java.util.logging.Logger.getLogger(server.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } catch (javax.swing.UnsupportedLookAndFeelException ex) { java.util.logging.Logger.getLogger(server.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); } //&lt;/editor-fold&gt; /* Create and display the form */ java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new server().setVisible(true); } }); } // Variables declaration - do not modify private javax.swing.JTextPane JTextPane; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JButton mulai; private javax.swing.JScrollPane text; private javax.swing.JTextArea text1; // End of variables declaration </code></pre> <p>}</p> <p>thanks for getting in my problem yogendra,i really appreciate it</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload