Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

I've tried to use JformDesigner,but what i've to do for use its java code?

807591Sep 26 2007 — edited Mar 28 2008
HI guys,i've tried to use the program"JFormDesigner" it's a powerful program,but i don't know what i've to do to use its java code, i've tryed to use this code:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import com.jgoodies.forms.factories.*;
import com.jgoodies.forms.layout.*;
/*
* Created by JFormDesigner on Wed Sep 26 10:41:44 CEST 2007
*/



/**
* @author
*/
public class FileReceiver extends JFrame {
public FileReceiver() {
initComponents();
}

public static void main( String args[] )
{
new FileReceiver();

}
private void initComponents() {
// JFormDesigner - Component initialization - DO NOT MODIFY //GEN-BEGIN:initComponents

dialogPane = new JPanel();
contentPanel = new JPanel();
sRicezione = new JLabel();
startButton = new JButton();
label2 = new JLabel();
chooseButton = new JButton();
saveButton = new JButton();
infoButton = new JButton();
buttonBar = new JPanel();
CellConstraints cc = new CellConstraints();

//======== this ========
setTitle("FileReceiver");
setResizable(false);
Container contentPane = getContentPane();
contentPane.setLayout(new BorderLayout());

//======== dialogPane ========
{
dialogPane.setBorder(Borders.DIALOG_BORDER);

// JFormDesigner evaluation mark
dialogPane.setBorder(new javax.swing.border.CompoundBorder(
new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
"JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
javax.swing.border.TitledBorder.BOTTOM, new java.awt.Font("Dialog", java.awt.Font.BOLD, 12),
java.awt.Color.red), dialogPane.getBorder())); dialogPane.addPropertyChangeListener(new java.beans.PropertyChangeListener(){public void propertyChange(java.beans.PropertyChangeEvent e){if("border".equals(e.getPropertyName()))throw new RuntimeException();}});

dialogPane.setLayout(null);

//======== contentPanel ========
{
contentPanel.setLayout(null);

//---- sRicezione ----
sRicezione.setText("Server in ascolto...");
contentPanel.add(sRicezione);
sRicezione.setBounds(new Rectangle(new Point(0, 6), sRicezione.getPreferredSize()));

//---- startButton ----
startButton.setText("Avvia");
startButton.setToolTipText("Avvia il tuo server");
contentPanel.add(startButton);
startButton.setBounds(308, 0, 117, startButton.getPreferredSize().height);

//---- label2 ----
label2.setText("Desktop\\");
contentPanel.add(label2);
label2.setBounds(0, 35, 238, label2.getPreferredSize().height);

//---- chooseButton ----
chooseButton.setText("Salva in...");
contentPanel.add(chooseButton);
chooseButton.setBounds(308, 29, 116, chooseButton.getPreferredSize().height);

//---- saveButton ----
saveButton.setText("Salva settaggi");
saveButton.setToolTipText("Salva le modifiche apportate");
contentPanel.add(saveButton);
saveButton.setBounds(308, 58, 116, saveButton.getPreferredSize().height);

//---- infoButton ----
infoButton.setText("Informazioni");
infoButton.setToolTipText("Mostra le informazioni riguardo il programma");
infoButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
infoButtonActionPerformed(e);

}
});
contentPanel.add(infoButton);
infoButton.setBounds(308, 92, 116, infoButton.getPreferredSize().height);

{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < contentPanel.getComponentCount(); i++) {
Rectangle bounds = contentPanel.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = contentPanel.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
contentPanel.setPreferredSize( preferredSize );
}
}
dialogPane.add(contentPanel);
contentPanel.setBounds(18, 15, 437, contentPanel.getPreferredSize().height);

//======== buttonBar ========
{
buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
buttonBar.setLayout(new FormLayout(
new ColumnSpec[] {
FormFactory.GLUE_COLSPEC,
FormFactory.BUTTON_COLSPEC,
FormFactory.RELATED_GAP_COLSPEC,
FormFactory.BUTTON_COLSPEC
},
RowSpec.decodeSpecs("pref")));
}
dialogPane.add(buttonBar);
buttonBar.setBounds(18, 239, 437, buttonBar.getPreferredSize().height);

{ // compute preferred size
Dimension preferredSize = new Dimension();
for(int i = 0; i < dialogPane.getComponentCount(); i++) {
Rectangle bounds = dialogPane.getComponent(i).getBounds();
preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
}
Insets insets = dialogPane.getInsets();
preferredSize.width += insets.right;
preferredSize.height += insets.bottom;
dialogPane.setPreferredSize( preferredSize );
}
}
contentPane.add(dialogPane, BorderLayout.CENTER);
// JFormDesigner - End of component initialization //GEN-END:initComponents
}

private void infoButtonActionPerformed(ActionEvent e) {
// TODO add your code here


JOptionPane.showMessageDialog( FileReceiver.this,
"Test dialog","Informazioni",JOptionPane.INFORMATION_MESSAGE );


}

// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
// Generated using JFormDesigner Evaluation license -
private JPanel dialogPane;
private JPanel contentPanel;
private JLabel sRicezione;
private JButton startButton;
private JLabel label2;
private JButton chooseButton;
private JButton saveButton;
private JButton infoButton;
private JPanel buttonBar;
// JFormDesigner - End of variables declaration //GEN-END:variables
}



But its doesn't work...anyhelps?Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 25 2008
Added on Sep 26 2007
15 comments
552 views