I am currently working on an application to convert VB forms to Java forms. I'm finding this a good way to learn Java. I plan to release it once finished. I can easily create a form using a JFrame but can't figure out how to convert it to an applet.
Any help would be appreciated. Minnimal changes is the goal here so I can translate easier.
TIA
-------
import javax.swing.*;
import javax.swing.JFrame;
import java.awt.*;
import java.awt.event.*;
public class frmCalendar
{
// set up menu bar
public JMenuBar createMenuBar(){
JMenuBar menubar;
JMenu mnuPopup_421;
JMenuItem mnuPopupMonth_423;
JMenuItem mnuPopupMonth_427;
JMenuItem mnuPopupMonth_431;
JMenuItem mnuPopupMonth_435;
JMenuItem mnuPopupMonth_439;
JMenuItem mnuPopupMonth_443;
JMenuItem mnuPopupMonth_447;
JMenuItem mnuPopupMonth_451;
JMenuItem mnuPopupMonth_455;
JMenuItem mnuPopupMonth_459;
JMenuItem mnuPopupMonth_463;
JMenuItem mnuPopupMonth_467;
menubar = new JMenuBar();
// Menu Parent mnuPopup
//setting up Menu - mnuPopup_421
mnuPopup_421 = new JMenu("File");
//setting up MenuItem - mnuPopupMonth_423
mnuPopupMonth_423 = new JMenuItem("January");
mnuPopup_421.add(mnuPopupMonth_423);
//setting up MenuItem - mnuPopupMonth_427
mnuPopupMonth_427 = new JMenuItem("February");
mnuPopup_421.add(mnuPopupMonth_427);
//setting up MenuItem - mnuPopupMonth_431
mnuPopupMonth_431 = new JMenuItem("March");
mnuPopup_421.add(mnuPopupMonth_431);
//setting up MenuItem - mnuPopupMonth_435
mnuPopupMonth_435 = new JMenuItem("April");
mnuPopup_421.add(mnuPopupMonth_435);
//setting up MenuItem - mnuPopupMonth_439
mnuPopupMonth_439 = new JMenuItem("May");
mnuPopup_421.add(mnuPopupMonth_439);
//setting up MenuItem - mnuPopupMonth_443
mnuPopupMonth_443 = new JMenuItem("June");
mnuPopup_421.add(mnuPopupMonth_443);
//setting up MenuItem - mnuPopupMonth_447
mnuPopupMonth_447 = new JMenuItem("July");
mnuPopup_421.add(mnuPopupMonth_447);
//setting up MenuItem - mnuPopupMonth_451
mnuPopupMonth_451 = new JMenuItem("August");
mnuPopup_421.add(mnuPopupMonth_451);
//setting up MenuItem - mnuPopupMonth_455
mnuPopupMonth_455 = new JMenuItem("September");
mnuPopup_421.add(mnuPopupMonth_455);
//setting up MenuItem - mnuPopupMonth_459
mnuPopupMonth_459 = new JMenuItem("October");
mnuPopup_421.add(mnuPopupMonth_459);
//setting up MenuItem - mnuPopupMonth_463
mnuPopupMonth_463 = new JMenuItem("November");
mnuPopup_421.add(mnuPopupMonth_463);
//setting up MenuItem - mnuPopupMonth_467
mnuPopupMonth_467 = new JMenuItem("December");
mnuPopup_421.add(mnuPopupMonth_467);
menubar.add(mnuPopup_421);
return menubar;
}
// set up container and form
public Container createContentPane(){
ButtonGroup cbg;
JPanel con;
// VB.PictureBox
JList picDays_30;
JButton cmdChangeDate_46;
JButton cmdChangeDate_58;
JButton cmdChangeDate_70;
JButton cmdChangeDate_84;
JButton cmdToday_96;
JCheckBox chkStayOnTop_105;
JButton cmdToday_113;
JButton cmdChangeDate_122;
JButton cmdChangeDate_134;
JButton cmdChangeDate_148;
JButton cmdChangeDate_160;
JButton cmdClose_172;
// VB.PictureBox
JList picDays_181;
// VB.PictureBox
JList picCalendar_197;
// Unknown VB.Shape
JLabel lblYear_220;
JLabel lblMonth_242;
// Unknown VB.Image
JLabel lblDate_272;
JLabel lblDate_286;
JLabel lblDayDiff_300;
// Unknown VB.Image
JLabel lblMonth_318;
JLabel lblYear_340;
JLabel lblDayDiff_362;
JLabel lblDayDiff_371;
// Unknown VB.Shape
// Unknown VB.Shape
// Unknown VB.Shape
// Setting up form frmCalendar
con = new JPanel(new BorderLayout());
con.setOpaque(true);
con.setFont(new Font("Helvetica", Font.PLAIN, 12));
con.setLayout(null);
cbg = new ButtonGroup();
//setting up PictureBox - picDays_30
picDays_30 = new JList();
JScrollPane sppicDays_30 = new JScrollPane(picDays_30);
sppicDays_30.setLocation(280, 80);
sppicDays_30.setSize(224, 16);
con.add(sppicDays_30);
//setting up JButton - cmdChangeDate_46
cmdChangeDate_46 = new JButton("");
cmdChangeDate_46.setBounds(465, 58, 18, 18);
con.add(cmdChangeDate_46);
//setting up JButton - cmdChangeDate_58
cmdChangeDate_58 = new JButton("");
cmdChangeDate_58.setBounds(483, 58, 18, 18);
con.add(cmdChangeDate_58);
//setting up JButton - cmdChangeDate_70
cmdChangeDate_70 = new JButton("");
cmdChangeDate_70.setBounds(380, 58, 18, 18);
con.add(cmdChangeDate_70);
//setting up JButton - cmdChangeDate_84
cmdChangeDate_84 = new JButton("");
cmdChangeDate_84.setBounds(398, 58, 18, 18);
con.add(cmdChangeDate_84);
//setting up JButton - cmdToday_96
cmdToday_96 = new JButton("Today");
cmdToday_96.setBounds(280, 250, 66, 21);
con.add(cmdToday_96);
//setting up JCheckBox - chkStayOnTop_105
chkStayOnTop_105 = new JCheckBox("Stay on top of other windows.");
chkStayOnTop_105.setBounds(20, 290, 246, 18);
con.add(chkStayOnTop_105);
//setting up JButton - cmdToday_113
cmdToday_113 = new JButton("Today");
cmdToday_113.setBounds(25, 250, 66, 21);
con.add(cmdToday_113);
//setting up JButton - cmdChangeDate_122
cmdChangeDate_122 = new JButton("");
cmdChangeDate_122.setBounds(143, 58, 18, 18);
con.add(cmdChangeDate_122);
//setting up JButton - cmdChangeDate_134
cmdChangeDate_134 = new JButton("");
cmdChangeDate_134.setBounds(125, 58, 18, 18);
con.add(cmdChangeDate_134);
//setting up JButton - cmdChangeDate_148
cmdChangeDate_148 = new JButton("");
cmdChangeDate_148.setBounds(228, 58, 18, 18);
con.add(cmdChangeDate_148);
//setting up JButton - cmdChangeDate_160
cmdChangeDate_160 = new JButton("");
cmdChangeDate_160.setBounds(210, 58, 18, 18);
con.add(cmdChangeDate_160);
//setting up JButton - cmdClose_172
cmdClose_172 = new JButton("&Close");
cmdClose_172.setBounds(415, 290, 97, 25);
con.add(cmdClose_172);
//setting up PictureBox - picDays_181
picDays_181 = new JList();
JScrollPane sppicDays_181 = new JScrollPane(picDays_181);
sppicDays_181.setLocation(25, 80);
sppicDays_181.setSize(224, 16);
con.add(sppicDays_181);
//setting up PictureBox - picCalendar_197
picCalendar_197 = new JList();
JScrollPane sppicCalendar_197 = new JScrollPane(picCalendar_197);
sppicCalendar_197.setLocation(25, 105);
sppicCalendar_197.setSize(225, 138);
con.add(sppicCalendar_197);
// Unknown type VB.Shape
// shpBorder_212 = new Shape;
// shpBorder_212.setBounds(270, 45, 246, 236);
// con.add(shpBorder_212);
//setting up JLabel - lblYear_220
lblYear_220 = new JLabel("lblYear");
lblYear_220.setFont(new Font("MS Sans Serif", Font.PLAIN, 8));
lblYear_220.setBounds(420, 60, 38, 17);
con.add(lblYear_220);
//setting up JLabel - lblMonth_242
lblMonth_242 = new JLabel("lblMonth");
lblMonth_242.setFont(new Font("MS Sans Serif", Font.PLAIN, 8));
lblMonth_242.setBounds(285, 60, 103, 16);
con.add(lblMonth_242);
// Unknown type VB.Image
// Image1_264 = new Image;
// Image1_264.setBounds(283, 57, 18, 20);
// con.add(Image1_264);
//setting up JLabel - lblDate_272
lblDate_272 = new JLabel("lblDate");
lblDate_272.setBounds(425, 255, 70, 13);
con.add(lblDate_272);
//setting up JLabel - lblDate_286
lblDate_286 = new JLabel("lblDate");
lblDate_286.setBounds(170, 255, 70, 13);
con.add(lblDate_286);
//setting up JLabel - lblDayDiff_300
lblDayDiff_300 = new JLabel("There are");
lblDayDiff_300.setBounds(15, 15, 46, 13);
con.add(lblDayDiff_300);
// Unknown type VB.Image
// Image1_310 = new Image;
// Image1_310.setBounds(28, 57, 18, 20);
// con.add(Image1_310);
//setting up JLabel - lblMonth_318
lblMonth_318 = new JLabel("lblMonth");
lblMonth_318.setFont(new Font("MS Sans Serif", Font.PLAIN, 8));
lblMonth_318.setBounds(30, 60, 103, 16);
con.add(lblMonth_318);
//setting up JLabel - lblYear_340
lblYear_340 = new JLabel("lblYear");
lblYear_340.setFont(new Font("MS Sans Serif", Font.PLAIN, 8));
lblYear_340.setBounds(165, 60, 38, 17);
con.add(lblYear_340);
//setting up JLabel - lblDayDiff_362
lblDayDiff_362 = new JLabel("days between");
lblDayDiff_362.setBounds(130, 15, 381, 23);
con.add(lblDayDiff_362);
//setting up JLabel - lblDayDiff_371
lblDayDiff_371 = new JLabel("lbDayDiffl");
lblDayDiff_371.setFont(new Font("MS Sans Serif", Font.PLAIN, 8));
lblDayDiff_371.setBounds(71, 14, 51, 18);
con.add(lblDayDiff_371);
// Unknown type VB.Shape
// shpBorder_393 = new Shape;
// shpBorder_393.setBounds(15, 45, 246, 236);
// con.add(shpBorder_393);
// Unknown type VB.Shape
// Shape1_401 = new Shape;
// Shape1_401.setBounds(25, 55, 225, 23);
// con.add(Shape1_401);
// Unknown type VB.Shape
// Shape1_411 = new Shape;
// Shape1_411.setBounds(280, 55, 225, 23);
// con.add(Shape1_411);
con.setSize(526, 332);
con.setVisible(true);
return con;
}
private static void createAndShowGUI()
{
JFrame frame = new JFrame ("ICD Calendar");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frmCalendar demo = new frmCalendar();
frame.setJMenuBar(demo.createMenuBar());
frame.setContentPane(demo.createContentPane());
frame.setSize(526, 332);
frame.setVisible(true);
}
public static void main(String args[])
{
javax.swing.SwingUtilities.invokeLater(new Runnable(){
public void run() {
createAndShowGUI();
}
});
}
}
Any help would be appreciated. Minnimal changes is the goal here so I can translate easier.
TIA
-------
import javax.swing.*;
import javax.swing.JFrame;
import java.awt.*;
import java.awt.event.*;
public class frmCalendar
{
// set up menu bar
public JMenuBar createMenuBar(){
JMenuBar menubar;
JMenu mnuPopup_421;
JMenuItem mnuPopupMonth_423;
JMenuItem mnuPopupMonth_427;
JMenuItem mnuPopupMonth_431;
JMenuItem mnuPopupMonth_435;
JMenuItem mnuPopupMonth_439;
JMenuItem mnuPopupMonth_443;
JMenuItem mnuPopupMonth_447;
JMenuItem mnuPopupMonth_451;
JMenuItem mnuPopupMonth_455;
JMenuItem mnuPopupMonth_459;
JMenuItem mnuPopupMonth_463;
JMenuItem mnuPopupMonth_467;
menubar = new JMenuBar();
// Menu Parent mnuPopup
//setting up Menu - mnuPopup_421
mnuPopup_421 = new JMenu("File");
//setting up MenuItem - mnuPopupMonth_423
mnuPopupMonth_423 = new JMenuItem("January");
mnuPopup_421.add(mnuPopupMonth_423);
//setting up MenuItem - mnuPopupMonth_427
mnuPopupMonth_427 = new JMenuItem("February");
mnuPopup_421.add(mnuPopupMonth_427);
//setting up MenuItem - mnuPopupMonth_431
mnuPopupMonth_431 = new JMenuItem("March");
mnuPopup_421.add(mnuPopupMonth_431);
//setting up MenuItem - mnuPopupMonth_435
mnuPopupMonth_435 = new JMenuItem("April");
mnuPopup_421.add(mnuPopupMonth_435);
//setting up MenuItem - mnuPopupMonth_439
mnuPopupMonth_439 = new JMenuItem("May");
mnuPopup_421.add(mnuPopupMonth_439);
//setting up MenuItem - mnuPopupMonth_443
mnuPopupMonth_443 = new JMenuItem("June");
mnuPopup_421.add(mnuPopupMonth_443);
//setting up MenuItem - mnuPopupMonth_447
mnuPopupMonth_447 = new JMenuItem("July");
mnuPopup_421.add(mnuPopupMonth_447);
//setting up MenuItem - mnuPopupMonth_451
mnuPopupMonth_451 = new JMenuItem("August");
mnuPopup_421.add(mnuPopupMonth_451);
//setting up MenuItem - mnuPopupMonth_455
mnuPopupMonth_455 = new JMenuItem("September");
mnuPopup_421.add(mnuPopupMonth_455);
//setting up MenuItem - mnuPopupMonth_459
mnuPopupMonth_459 = new JMenuItem("October");
mnuPopup_421.add(mnuPopupMonth_459);
//setting up MenuItem - mnuPopupMonth_463
mnuPopupMonth_463 = new JMenuItem("November");
mnuPopup_421.add(mnuPopupMonth_463);
//setting up MenuItem - mnuPopupMonth_467
mnuPopupMonth_467 = new JMenuItem("December");
mnuPopup_421.add(mnuPopupMonth_467);
menubar.add(mnuPopup_421);
return menubar;
}
// set up container and form
public Container createContentPane(){
ButtonGroup cbg;
JPanel con;
// VB.PictureBox
JList picDays_30;
JButton cmdChangeDate_46;
JButton cmdChangeDate_58;
JButton cmdChangeDate_70;
JButton cmdChangeDate_84;
JButton cmdToday_96;
JCheckBox chkStayOnTop_105;
JButton cmdToday_113;
JButton cmdChangeDate_122;
JButton cmdChangeDate_134;
JButton cmdChangeDate_148;
JButton cmdChangeDate_160;
JButton cmdClose_172;
// VB.PictureBox
JList picDays_181;
// VB.PictureBox
JList picCalendar_197;
// Unknown VB.Shape
JLabel lblYear_220;
JLabel lblMonth_242;
// Unknown VB.Image
JLabel lblDate_272;
JLabel lblDate_286;
JLabel lblDayDiff_300;
// Unknown VB.Image
JLabel lblMonth_318;
JLabel lblYear_340;
JLabel lblDayDiff_362;
JLabel lblDayDiff_371;
// Unknown VB.Shape
// Unknown VB.Shape
// Unknown VB.Shape
// Setting up form frmCalendar
con = new JPanel(new BorderLayout());
con.setOpaque(true);
con.setFont(new Font("Helvetica", Font.PLAIN, 12));
con.setLayout(null);
cbg = new ButtonGroup();
//setting up PictureBox - picDays_30
picDays_30 = new JList();
JScrollPane sppicDays_30 = new JScrollPane(picDays_30);
sppicDays_30.setLocation(280, 80);
sppicDays_30.setSize(224, 16);
con.add(sppicDays_30);
//setting up JButton - cmdChangeDate_46
cmdChangeDate_46 = new JButton("");
cmdChangeDate_46.setBounds(465, 58, 18, 18);
con.add(cmdChangeDate_46);
//setting up JButton - cmdChangeDate_58
cmdChangeDate_58 = new JButton("");
cmdChangeDate_58.setBounds(483, 58, 18, 18);
con.add(cmdChangeDate_58);
//setting up JButton - cmdChangeDate_70
cmdChangeDate_70 = new JButton("");
cmdChangeDate_70.setBounds(380, 58, 18, 18);
con.add(cmdChangeDate_70);
//setting up JButton - cmdChangeDate_84
cmdChangeDate_84 = new JButton("");
cmdChangeDate_84.setBounds(398, 58, 18, 18);
con.add(cmdChangeDate_84);
//setting up JButton - cmdToday_96
cmdToday_96 = new JButton("Today");
cmdToday_96.setBounds(280, 250, 66, 21);
con.add(cmdToday_96);
//setting up JCheckBox - chkStayOnTop_105
chkStayOnTop_105 = new JCheckBox("Stay on top of other windows.");
chkStayOnTop_105.setBounds(20, 290, 246, 18);
con.add(chkStayOnTop_105);
//setting up JButton - cmdToday_113
cmdToday_113 = new JButton("Today");
cmdToday_113.setBounds(25, 250, 66, 21);
con.add(cmdToday_113);
//setting up JButton - cmdChangeDate_122
cmdChangeDate_122 = new JButton("");
cmdChangeDate_122.setBounds(143, 58, 18, 18);
con.add(cmdChangeDate_122);
//setting up JButton - cmdChangeDate_134
cmdChangeDate_134 = new JButton("");
cmdChangeDate_134.setBounds(125, 58, 18, 18);
con.add(cmdChangeDate_134);
//setting up JButton - cmdChangeDate_148
cmdChangeDate_148 = new JButton("");
cmdChangeDate_148.setBounds(228, 58, 18, 18);
con.add(cmdChangeDate_148);
//setting up JButton - cmdChangeDate_160
cmdChangeDate_160 = new JButton("");
cmdChangeDate_160.setBounds(210, 58, 18, 18);
con.add(cmdChangeDate_160);
//setting up JButton - cmdClose_172
cmdClose_172 = new JButton("&Close");
cmdClose_172.setBounds(415, 290, 97, 25);
con.add(cmdClose_172);
//setting up PictureBox - picDays_181
picDays_181 = new JList();
JScrollPane sppicDays_181 = new JScrollPane(picDays_181);
sppicDays_181.setLocation(25, 80);
sppicDays_181.setSize(224, 16);
con.add(sppicDays_181);
//setting up PictureBox - picCalendar_197
picCalendar_197 = new JList();
JScrollPane sppicCalendar_197 = new JScrollPane(picCalendar_197);
sppicCalendar_197.setLocation(25, 105);
sppicCalendar_197.setSize(225, 138);
con.add(sppicCalendar_197);
// Unknown type VB.Shape
// shpBorder_212 = new Shape;
// shpBorder_212.setBounds(270, 45, 246, 236);
// con.add(shpBorder_212);
//setting up JLabel - lblYear_220
lblYear_220 = new JLabel("lblYear");
lblYear_220.setFont(new Font("MS Sans Serif", Font.PLAIN, 8));
lblYear_220.setBounds(420, 60, 38, 17);
con.add(lblYear_220);
//setting up JLabel - lblMonth_242
lblMonth_242 = new JLabel("lblMonth");
lblMonth_242.setFont(new Font("MS Sans Serif", Font.PLAIN, 8));
lblMonth_242.setBounds(285, 60, 103, 16);
con.add(lblMonth_242);
// Unknown type VB.Image
// Image1_264 = new Image;
// Image1_264.setBounds(283, 57, 18, 20);
// con.add(Image1_264);
//setting up JLabel - lblDate_272
lblDate_272 = new JLabel("lblDate");
lblDate_272.setBounds(425, 255, 70, 13);
con.add(lblDate_272);
//setting up JLabel - lblDate_286
lblDate_286 = new JLabel("lblDate");
lblDate_286.setBounds(170, 255, 70, 13);
con.add(lblDate_286);
//setting up JLabel - lblDayDiff_300
lblDayDiff_300 = new JLabel("There are");
lblDayDiff_300.setBounds(15, 15, 46, 13);
con.add(lblDayDiff_300);
// Unknown type VB.Image
// Image1_310 = new Image;
// Image1_310.setBounds(28, 57, 18, 20);
// con.add(Image1_310);
//setting up JLabel - lblMonth_318
lblMonth_318 = new JLabel("lblMonth");
lblMonth_318.setFont(new Font("MS Sans Serif", Font.PLAIN, 8));
lblMonth_318.setBounds(30, 60, 103, 16);
con.add(lblMonth_318);
//setting up JLabel - lblYear_340
lblYear_340 = new JLabel("lblYear");
lblYear_340.setFont(new Font("MS Sans Serif", Font.PLAIN, 8));
lblYear_340.setBounds(165, 60, 38, 17);
con.add(lblYear_340);
//setting up JLabel - lblDayDiff_362
lblDayDiff_362 = new JLabel("days between");
lblDayDiff_362.setBounds(130, 15, 381, 23);
con.add(lblDayDiff_362);
//setting up JLabel - lblDayDiff_371
lblDayDiff_371 = new JLabel("lbDayDiffl");
lblDayDiff_371.setFont(new Font("MS Sans Serif", Font.PLAIN, 8));
lblDayDiff_371.setBounds(71, 14, 51, 18);
con.add(lblDayDiff_371);
// Unknown type VB.Shape
// shpBorder_393 = new Shape;
// shpBorder_393.setBounds(15, 45, 246, 236);
// con.add(shpBorder_393);
// Unknown type VB.Shape
// Shape1_401 = new Shape;
// Shape1_401.setBounds(25, 55, 225, 23);
// con.add(Shape1_401);
// Unknown type VB.Shape
// Shape1_411 = new Shape;
// Shape1_411.setBounds(280, 55, 225, 23);
// con.add(Shape1_411);
con.setSize(526, 332);
con.setVisible(true);
return con;
}
private static void createAndShowGUI()
{
JFrame frame = new JFrame ("ICD Calendar");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frmCalendar demo = new frmCalendar();
frame.setJMenuBar(demo.createMenuBar());
frame.setContentPane(demo.createContentPane());
frame.setSize(526, 332);
frame.setVisible(true);
}
public static void main(String args[])
{
javax.swing.SwingUtilities.invokeLater(new Runnable(){
public void run() {
createAndShowGUI();
}
});
}
}