Results 1 to 1 of 1
- 01-20-2012, 06:44 AM #1
Member
- Join Date
- Jan 2012
- Posts
- 48
- Rep Power
- 0
which part to insert to retrieve from the database and appear in a jButton?
Java Code:package HealthOK.ui; import javax.swing.JPanel; import java.awt.Color; import java.awt.Dimension; import javax.swing.JLabel; import java.awt.Rectangle; import javax.swing.ImageIcon; import javax.swing.JFrame; import java.awt.Font; import javax.swing.JButton; import java.awt.Point; import javax.swing.JScrollPane; import java.awt.event.KeyEvent; import javax.swing.JTextField; public class ForumPanel extends JPanel { private static final long serialVersionUID = 1L; private JLabel jLabelHeading = null; private JLabel jLabelLogo = null; private JLabel jLabelAppName = null; private JButton jButtonPostQuestion = null; private JFrame myFrame = null; private JScrollPane jScrollPaneCells = null; private JButton jButtonMenu1 = null; private JLabel jLabelHeadings = null; private JLabel jLabelHeadings1 = null; private JLabel jLabel1 = null; private JButton jButton1 = null; private JTextField jTextField2 = null; /** * This is the default constructor */ public ForumPanel() { super(); initialize(); } public ForumPanel(JFrame f){ this(); myFrame = f; } /** * This method initialises this * * @return void */ private void initialize() { jLabelAppName = new JLabel(); jLabelAppName.setText(" Health-OK!"); jLabelAppName.setSize(new Dimension(82, 26)); jLabelAppName.setFont(new Font("Dialog", Font.BOLD, 14)); jLabelAppName.setLocation(new Point(68, 29)); jLabelHeading = new JLabel(); jLabelHeading.setBounds(new Rectangle(155, 48, 430, 88)); jLabelHeading.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/Forum.png"))); jLabelHeading.setText(""); this.setSize(700, 530); this.setLayout(null); this.setBackground(Color.white); this.add(jLabelHeading, null); this.add(getJLabelLogo(), null); this.add(jLabelAppName, null); this.add(getJButtonPostQuestion(), null); this.add(getJScrollPaneCells(), null); this.add(getJButtonMenu1(), null); } /** * This method initialises jLabelLogo * * @return javax.swing.JLabel */ private JLabel getJLabelLogo() { if (jLabelLogo == null) { jLabelLogo = new JLabel(); jLabelLogo.setText("JLabel"); jLabelLogo.setSize(new Dimension(70, 57)); jLabelLogo.setIcon(new ImageIcon(getClass().getResource("/HealthOK/ui/images/crewzfive.png"))); jLabelLogo.setLocation(new Point(4, 13)); } return jLabelLogo; } /** * This method initialises jButtonPostQuestion * * @return javax.swing.JButton */ private JButton getJButtonPostQuestion() { if (jButtonPostQuestion == null) { jButtonPostQuestion = new JButton(); jButtonPostQuestion.setBounds(new Rectangle(17, 138, 168, 40)); jButtonPostQuestion.setFont(new Font("Dialog", Font.BOLD, 14)); jButtonPostQuestion.setText("Post New Question"); jButtonPostQuestion.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { JPanel panel = new ForumNewQuestionPanel(); myFrame.getContentPane().removeAll(); myFrame.getContentPane().add(panel); myFrame.getContentPane().validate(); myFrame.getContentPane().repaint(); } }); } return jButtonPostQuestion; } /** * This method initialises jScrollPaneCells * * @return javax.swing.JScrollPane */ private JScrollPane getJScrollPaneCells() { if (jScrollPaneCells == null) { jLabel1 = new JLabel(); jLabel1.setBounds(new Rectangle(-2, 46, 542, 42)); jLabel1.setText(""); jLabelHeadings1 = new JLabel(); jLabelHeadings1.setBounds(new Rectangle(95, 13, 65, 32)); jLabelHeadings1.setFont(new Font("Dialog", Font.BOLD, 18)); jLabelHeadings1.setText("Topics"); jLabelHeadings = new JLabel(); jLabelHeadings.setText("Author"); jLabelHeadings.setDisplayedMnemonic(KeyEvent.VK_UNDEFINED); jLabelHeadings.setBounds(new Rectangle(387, 14, 64, 31)); jLabelHeadings.setFont(new Font("Dialog", Font.BOLD, 18)); jScrollPaneCells = new JScrollPane(); jScrollPaneCells.setBounds(new Rectangle(104, 192, 560, 285)); jScrollPaneCells.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); jScrollPaneCells.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); } JPanel borderlaoutpanel = new JPanel(); jScrollPaneCells.setViewportView(borderlaoutpanel); borderlaoutpanel.setLayout(null); borderlaoutpanel.setBackground(Color.white); JPanel columnpanel = new JPanel(); columnpanel.setBackground(Color.pink); columnpanel.setBounds(new Rectangle(0, 1, 541, 11)); borderlaoutpanel.add(columnpanel, null); borderlaoutpanel.add(jLabelHeadings, null); borderlaoutpanel.add(jLabelHeadings1, null); borderlaoutpanel.add(jLabel1, null); borderlaoutpanel.add(getJButton1(), null); borderlaoutpanel.add(getJTextField2(), null); return jScrollPaneCells; } /** * This method initialises jButtonMenu1 * * @return javax.swing.JButton */ private JButton getJButtonMenu1() { if (jButtonMenu1 == null) { jButtonMenu1 = new JButton(); jButtonMenu1.setBounds(new Rectangle(561, 480, 96, 36)); jButtonMenu1.setFont(new Font("Dialog", Font.BOLD, 18)); jButtonMenu1.setText("Menu"); jButtonMenu1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { JPanel panel = new MenuPanel(); myFrame.getContentPane().removeAll(); myFrame.getContentPane().add(panel); myFrame.getContentPane().validate(); myFrame.getContentPane().repaint(); } }); } return jButtonMenu1; } /** * This method initializes jButton1 * * @return javax.swing.JButton */ private JButton getJButton1() { if (jButton1 == null) { jButton1 = new JButton(); jButton1.setBounds(new Rectangle(0, 48, 260, 36)); jButton1.setBackground(Color.white); jButton1.setText("BLAH BLAH BLAH"); jButton1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { System.out.println("actionPerformed()"); // TODO Auto-generated Event stub actionPerformed() } }); } return jButton1; } /** * This method initializes jTextField2 * * @return javax.swing.JTextField */ private JTextField getJTextField2() { if (jTextField2 == null) { jTextField2 = new JTextField(); jTextField2.setBounds(new Rectangle(285, 48, 256, 37)); } return jTextField2; } }Last edited by mathidioticz; 01-20-2012 at 06:57 AM.
Similar Threads
-
Insert and retrieve embedded Buttons from JTextPanel
By peterme in forum Advanced JavaReplies: 7Last Post: 01-20-2010, 10:57 PM -
JSP code to connect, store and retrieve from database
By HarryJade in forum New To JavaReplies: 1Last Post: 12-26-2009, 03:45 AM -
how to insert/retrieve jpg img format from MSAccess???
By vrk in forum JDBCReplies: 3Last Post: 04-30-2009, 09:28 AM -
How to insert a JButton?
By aRTx in forum New To JavaReplies: 1Last Post: 04-02-2009, 09:43 PM -
How to insert large data into database using one insert query
By sandeepsai39 in forum New To JavaReplies: 3Last Post: 02-28-2009, 09:17 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks