Results 1 to 3 of 3
Thread: jscrollpane and jdescktoppane
- 11-02-2009, 06:52 PM #1
Member
- Join Date
- Sep 2009
- Posts
- 9
- Rep Power
- 0
jscrollpane and jdescktoppane
hi guys,
i have problems with adding the jscrollpane to jdesktoppanel, here is my code if any spot a mistake really appreciate it if u could send a reply
many tanx
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* NewJFrame2.java
*
* Created on 02-Nov-2009, 18:05:56
*/
package Frames;
/**
*
* @author qyt21516
*/
public class NewJFrame2 extends javax.swing.JFrame {
/** Creates new form NewJFrame2 */
public NewJFrame2() {
initComponents();
}
/** 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() {
jSplitPane1 = new javax.swing.JSplitPane();
jPanel1 = new javax.swing.JPanel();
jScrollPane1 = new javax.swing.JScrollPane();
jDesktopPane1 = new javax.swing.JDesktopPane();
jInternalFrame1 = new javax.swing.JInternalFrame();
jInternalFrame2 = new javax.swing.JInternalFrame();
jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu();
jMenu2 = new javax.swing.JMenu();
setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
.addGap(0, 100, Short.MAX_VALUE)
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
.addGap(0, 255, Short.MAX_VALUE)
);
jSplitPane1.setLeftComponent(jPanel1);
jInternalFrame1.setVisible(true);
javax.swing.GroupLayout jInternalFrame1Layout = new javax.swing.GroupLayout(jInternalFrame1.getContent Pane());
jInternalFrame1.getContentPane().setLayout(jIntern alFrame1Layout);
jInternalFrame1Layout.setHorizontalGroup(
jInternalFrame1Layout.createParallelGroup(javax.sw ing.GroupLayout.Alignment.LEADING)
.addGap(0, 90, Short.MAX_VALUE)
);
jInternalFrame1Layout.setVerticalGroup(
jInternalFrame1Layout.createParallelGroup(javax.sw ing.GroupLayout.Alignment.LEADING)
.addGap(0, 75, Short.MAX_VALUE)
);
jInternalFrame1.setBounds(60, 50, 100, 110);
jDesktopPane1.add(jInternalFrame1, javax.swing.JLayeredPane.DEFAULT_LAYER);
jInternalFrame2.setVisible(true);
javax.swing.GroupLayout jInternalFrame2Layout = new javax.swing.GroupLayout(jInternalFrame2.getContent Pane());
jInternalFrame2.getContentPane().setLayout(jIntern alFrame2Layout);
jInternalFrame2Layout.setHorizontalGroup(
jInternalFrame2Layout.createParallelGroup(javax.sw ing.GroupLayout.Alignment.LEADING)
.addGap(0, 80, Short.MAX_VALUE)
);
jInternalFrame2Layout.setVerticalGroup(
jInternalFrame2Layout.createParallelGroup(javax.sw ing.GroupLayout.Alignment.LEADING)
.addGap(0, 75, Short.MAX_VALUE)
);
jInternalFrame2.setBounds(170, 100, 90, 110);
jDesktopPane1.add(jInternalFrame2, javax.swing.JLayeredPane.DEFAULT_LAYER);
jScrollPane1.setViewportView(jDesktopPane1);
jSplitPane1.setRightComponent(jScrollPane1);
jMenu1.setText("File");
jMenuBar1.add(jMenu1);
jMenu2.setText("Edit");
jMenuBar1.add(jMenu2);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 380, Short.MAX_VALUE)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jSplitPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 257, Short.MAX_VALUE)
.addContainerGap())
);
pack();
}// </editor-fold>
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame2().setVisible(true);
}
});
}
// Variables declaration - do not modify
private javax.swing.JDesktopPane jDesktopPane1;
private javax.swing.JInternalFrame jInternalFrame1;
private javax.swing.JInternalFrame jInternalFrame2;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JSplitPane jSplitPane1;
// End of variables declaration
}
- 11-02-2009, 07:52 PM #2
Senior Member
- Join Date
- Jul 2009
- Posts
- 1,143
- Rep Power
- 5
Use the "Code" button when posting code so the code retains its original formatting.
The basics should be:
I never use IDE and am not about to try and debug the awfull generated GroupLayout code. Learn to create and code your GUI's by hand and don't rely on an IDE to generate the code.Java Code:JScrollPane scrollPane = new JScrollPane( desktopPane ); frame.add( scrollPane );
- 11-03-2009, 09:42 AM #3
Member
- Join Date
- Sep 2009
- Posts
- 9
- Rep Power
- 0
Similar Threads
-
JTextArea with JScrollPane
By AndrewM16921 in forum AWT / SwingReplies: 8Last Post: 10-30-2009, 12:06 AM -
JScrollPane problem
By KArelVH in forum AWT / SwingReplies: 6Last Post: 04-27-2009, 09:40 PM -
jscrollpane
By kaemonsaionji in forum New To JavaReplies: 3Last Post: 02-25-2009, 08:39 AM -
problem with Jscrollpane
By ravrajesh.ap in forum AWT / SwingReplies: 5Last Post: 01-03-2009, 10:38 PM -
help with JScrollPane
By tommy in forum AWT / SwingReplies: 1Last Post: 08-06-2007, 07:58 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks