Click here to Skip to main content
15,889,595 members
Home / Discussions / Java
   

Java

 
AnswerRe: Extracting text from docx using java Pin
Richard MacCutchan10-Oct-14 21:25
mveRichard MacCutchan10-Oct-14 21:25 
Questionhow to display panel just below input panel.? Pin
mybm17-Oct-14 0:41
mybm17-Oct-14 0:41 
AnswerRe: how to display panel just below input panel.? Pin
tony_ming7-Oct-14 2:36
tony_ming7-Oct-14 2:36 
GeneralRe: how to display panel just below input panel.? Pin
Member 109447528-Nov-14 18:25
Member 109447528-Nov-14 18:25 
QuestionRe: how to display panel just below input panel.? Pin
Richard MacCutchan7-Oct-14 2:50
mveRichard MacCutchan7-Oct-14 2:50 
AnswerRe: how to display panel just below input panel.? Pin
mybm17-Oct-14 18:00
mybm17-Oct-14 18:00 
GeneralRe: how to display panel just below input panel.? Pin
Richard MacCutchan7-Oct-14 22:26
mveRichard MacCutchan7-Oct-14 22:26 
GeneralRe: how to display panel just below input panel.? Pin
mybm18-Oct-14 2:55
mybm18-Oct-14 2:55 
<blockquote class="quote"><div class="op">Quote:</div>/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package Speech.WavePanel;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import javax.swing.JFrame;
import javax.swing.JScrollBar;
import javax.swing.JScrollPane;
import javax.swing.SwingUtilities;

/**
 *
 * @author saikat
 */
public class output extends javax.swing.JFrame {

    String filepath;     
    String fileContents;
    File file;
    BufferedReader br;
    /**
     * Creates new form output
     */
    public output() {
        initComponents();
        
       // JScrollPane.setSize(new java.awt.Dimension((xSize - graphFromScreen), graphVerticalSize));
      //  jScrollPane1.setPreferredSize(new java.awt.Dimension((xSize - graphFromScreen), graphVerticalSize));
       // jScrollPane1.setMinimumSize(new java.awt.Dimension((xSize - graphFromScreen), graphVerticalSize));
    
    }
    
    private void ScreenProperties()
    {
        
        
     jLabel1.setSize(new Dimension(800, 150));
     jLabel1.setPreferredSize(new Dimension(800, 150));
     
     
     JFrame frame= new JFrame();
     frame.setLocation(1650, 430);
     
      JScrollPane scrollPane = new JScrollPane(jLabel1);
      add(scrollPane, BorderLayout.CENTER);
      
                scrollPane = new JScrollPane();
		scrollPane.getViewport().add( jLabel1 );
		//JFrame.add( scrollPane, BorderLayout.CENTER );
                
      
      
     
      
        //JScrollPane pane = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
        //frame.setSize(500, 200);
       // frame.setContentPane(pane);
      
      
      
         
    }
    
    

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">                          
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        jPanel1 = new javax.swing.JPanel();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        jLabel1 = new javax.swing.JLabel();
        jButton4 = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        jButton1 = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JSeparator();

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 100, Short.MAX_VALUE)
        );

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jScrollPane3.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
        jScrollPane3.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
        jScrollPane3.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        jScrollPane3.setDebugGraphicsOptions(javax.swing.DebugGraphics.NONE_OPTION);

        jLabel1.setForeground(java.awt.Color.black);
        jLabel1.setText("jLabel1");
        jScrollPane3.setViewportView(jLabel1);

        jButton4.setText("output_frame4");
        jButton4.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton4MouseClicked(evt);
            }
        });
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        jButton3.setText("output_frame3");
        jButton3.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton3MouseClicked(evt);
            }
        });
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton2.setText("output_frame2");
        jButton2.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton2MouseClicked(evt);
            }
        });

        jButton1.setText("output_frame1");
        jButton1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jButton1MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 670, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jButton1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton2)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton3)
                        .addGap(18, 18, 18)
                        .addComponent(jButton4)))
                .addContainerGap())
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jButton2)
                    .addComponent(jButton3)
                    .addComponent(jButton4))
                .addGap(9, 9, 9)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 12, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>                        

    private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {                                      
        // TODO add your handling code here:
        
        
         setTitle(" OUTPUT PANEL ");
        setBackground(Color.white);
            setVisible(true); 
       // setSize(450,40);
        filepath ="/home/GUI/Language_Independent/Output/Frame_1.txt";  
        file = new File(filepath);
        fileContents="";               
     //   System.out.println ("hello"); 
        try{
            br = new BufferedReader ( new FileReader ( filepath )  ) ;
        }
        catch(Exception E){
            jLabel1.setText(E.toString());
        }
     
        try{ 
            while  ((fileContents = br.readLine()) != null)   {
	        System.out.println (fileContents) ;                
                jLabel1.setText(fileContents);    
	}
 	
        br.close();
        }
        catch(Exception E2){
           jLabel1.setText(E2.toString());
        }
       
    }                                     

    private void jButton2MouseClicked(java.awt.event.MouseEvent evt) {                                      


         //setTitle("OUTPUT PANEL 2");
         setBackground(Color.WHITE);
         setVisible(true);
         //setSize(450, 40);
         
         filepath="/home/GUI/Language_Independent/Output/Frame_2.txt";
         file=new File(filepath);
         fileContents="";
         
         try
         {
             br = new BufferedReader(new FileReader(filepath));
       
         }
         catch(Exception E)
         {
           jLabel1.setText(E.toString());
           
         }
         
         try
         {
             while((fileContents= br.readLine())!=null)
             {
                 System.out.println("fileContents");
                 jLabel1.setText(fileContents);
             }
             br.close();
         }
         catch(Exception E1)
         {
             jLabel1.setText(E1.toString());
         }    
        
        
// TODO add your handling code here:
    }                                     

    private void jButton3MouseClicked(java.awt.event.MouseEvent evt) {                                      

     
   
        

     // TODO add your handling code here:
    }                                     

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {                                         
 
    filepath ="/home/GUI/Language_Independent/Output/Frame_4.txt";
    file =new File(filepath);
    fileContents="";
    
    try
         {
             br = new BufferedReader(new FileReader(filepath));
       
         }
         catch(Exception E)
         {
           jLabel1.setText(E.toString());
           
         }
    
    try
         {
             while((fileContents= br.readLine())!=null)
             {
                 System.out.println("fileContents");
                 jLabel1.setText(fileContents);
             }
             br.close();
         }
         catch(Exception E1)
         {
             jLabel1.setText(E1.toString());
         }    
        
    
    
    
    
        // TODO add your handling code here:
    }                                        

    private void jButton4MouseClicked(java.awt.event.MouseEvent evt) {                                      

         filepath="";
         file= new File(filepath);
         fileContents="";
         
         try
         {
             br= new BufferedReader(new FileReader(filepath)); 
         }
         catch(Exception E)
         {
           jLabel1.setText(E.toString());  
         }
            
         
         try
         {
              while((fileContents= br.readLine())!=null)
             {
                 System.out.println("fileContents");
                 jLabel1.setText(fileContents);
             }
             br.close();       
         }
         catch(Exception E1)
         {
             jLabel1.setText(E1.toString());
         }
// TODO add your handling code here:
    }                                     

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {                                         
   
        filepath="";
        file = new File(filepath);
        fileContents ="";
        
        
        
    // TODO add your handling code here:
    }                                        

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        
         
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* 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(output.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(output.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(output.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(output.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>
        

        /* Create and display the form */
         SwingUtilities.invokeLater(new Runnable(){
       // java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new output().setVisible(true);
                
                
                 JScrollPane pn= new JScrollPane();
                 pn.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
                  pn.getVerticalScrollBar().setUnitIncrement(10);
                   
                 pn.setVisible(true);
               // frame.setVisible(true);
                
            }
        });
    }

    // Variables declaration - do not modify                     
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JSeparator jSeparator1;
    // End of variables declaration                   
}
</blockquote>


This is the output file which I want it to display just below my input panel when actionlistener is performed at input panel .actually to make it do i need to create the output panel inside the frame which contained input panel itself? thanks in advance..
Questionerror: could not find or load main class Pin
Member 1108183230-Sep-14 10:00
Member 1108183230-Sep-14 10:00 
SuggestionRe: error: could not find or load main class Pin
Richard MacCutchan30-Sep-14 21:04
mveRichard MacCutchan30-Sep-14 21:04 
GeneralRe: error: could not find or load main class Pin
Member 110818321-Oct-14 11:14
Member 110818321-Oct-14 11:14 
GeneralRe: error: could not find or load main class Pin
Richard MacCutchan1-Oct-14 21:24
mveRichard MacCutchan1-Oct-14 21:24 
GeneralRe: error: could not find or load main class Pin
Oscar06-Oct-14 13:18
Oscar06-Oct-14 13:18 
AnswerRe: error: could not find or load main class Pin
TorstenH.1-Oct-14 21:03
TorstenH.1-Oct-14 21:03 
AnswerRe: error: could not find or load main class Pin
Member 1115477415-Oct-14 0:20
Member 1115477415-Oct-14 0:20 
QuestionDeploy an ASP.NET application on WebLogic Pin
ThetaClear29-Sep-14 3:57
ThetaClear29-Sep-14 3:57 
AnswerRe: Deploy an ASP.NET application on WebLogic Pin
Richard MacCutchan29-Sep-14 5:30
mveRichard MacCutchan29-Sep-14 5:30 
GeneralRe: Deploy an ASP.NET application on WebLogic Pin
ThetaClear29-Sep-14 5:33
ThetaClear29-Sep-14 5:33 
GeneralRe: Deploy an ASP.NET application on WebLogic Pin
Richard MacCutchan29-Sep-14 5:43
mveRichard MacCutchan29-Sep-14 5:43 
GeneralRe: Deploy an ASP.NET application on WebLogic Pin
ZurdoDev30-Sep-14 10:30
professionalZurdoDev30-Sep-14 10:30 
GeneralRe: Deploy an ASP.NET application on WebLogic Pin
Richard MacCutchan30-Sep-14 21:02
mveRichard MacCutchan30-Sep-14 21:02 
GeneralRe: Deploy an ASP.NET application on WebLogic Pin
ZurdoDev1-Oct-14 1:17
professionalZurdoDev1-Oct-14 1:17 
GeneralRe: Deploy an ASP.NET application on WebLogic Pin
Richard MacCutchan1-Oct-14 1:27
mveRichard MacCutchan1-Oct-14 1:27 
AnswerRe: Deploy an ASP.NET application on WebLogic Pin
jschell29-Sep-14 7:53
jschell29-Sep-14 7:53 
QuestionError connecting Oracle on localhost: Could not get JDBC Connection ? Pin
taibc27-Sep-14 5:56
taibc27-Sep-14 5:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.