Helpful Information
 
 
Category: Computer Programming
Visual J++

Hey I have a problem with an app being made in Visual J++ I was hoping someone could help.

Ok Well I looked deeper into my application and found what could be the problem. For a while it was that if I had set the form borderstyle to none it would not maximize. otherwise it would. Now the other problem It created was this: I then added a picture to the picturebox found on my form and now the form even when the form borderstyle property is set to sizable it would not maximize nor would it load the controls which are the picture box and a label. Here is my code from the project.
There are 2 forms:
This is the one that loads when the application is run(this works fine):
import com.ms.wfc.app.*;
import com.ms.wfc.core.*;
import com.ms.wfc.ui.*;
import com.ms.wfc.html.*;

/**
* This class can take a variable number of parameters on the command
* line. Program execution begins with the main() method. The class
* constructor is not invoked unless an object of type 'Oira' is
* created in the main() method.
*/
public class Oira extends Form
{
public long HP;
public int ImageToShow;
public Oira()
{
// Required for Visual J++ Form Designer support
initForm();

// TODO: Add any constructor code after initForm call

}

/**
* Oira overrides dispose so it can clean up the
* component list.
*/
public void dispose()
{
super.dispose();
components.dispose();
}

private void tmrPause_timer(Object source, Event e)
{
//Application. for actual location
if (ImageToShow==0){
//pictureBox1.setImage((Bitmap)resources.getObject("pictureBox1_image"));
ImageToShow++;
}
else{
this.hide();
tmrPause.setEnabled(false);
MainScreen MainDlg=new MainScreen();
MainDlg.showDialog();
}


}





/**
* NOTE: The following code is required by the Visual J++ form
* designer. It can be modified using the form editor. Do not
* modify it using the code editor.
*/
Container components = new Container();
PictureBox pictureBox1 = new PictureBox();
Timer tmrPause = new Timer(components);

private void initForm()
{
// NOTE: This form is storing resource information in an
// external file. Do not modify the string parameter to any
// resources.getObject() function call. For example, do not
// modify "foo1_location" in the following line of code
// even if the name of the Foo object changes:
// foo1.setLocation((Point)resources.getObject("foo1_location"));

IResourceManager resources = new ResourceManager(this, "Oira");
this.setBackColor(Color.WHITE);
this.setText("Dark Destiny");
this.setAutoScaleBaseSize(new Point(5, 13));
this.setBorderStyle(FormBorderStyle.NONE);
this.setClientSize(new Point(395, 514));
this.setStartPosition(FormStartPosition.MANUAL);
this.setWindowState(FormWindowState.MAXIMIZED);

pictureBox1.setLocation(new Point(256, 216));
pictureBox1.setSize(new Point(127, 280));
pictureBox1.setTabIndex(0);
pictureBox1.setTabStop(false);
pictureBox1.setText("pictureBox1");
pictureBox1.setImage((Bitmap)resources.getObject("pictureBox1_image"));
pictureBox1.setSizeMode(PictureBoxSizeMode.AUTO_SIZE);

tmrPause.setInterval(5000);
tmrPause.setEnabled(true);
tmrPause.addOnTimer(new EventHandler(this.tmrPause_timer));
/* @designTimeOnly tmrPause.setLocation(new Point(16, 104)); */

this.setNewControls(new Control[] {
pictureBox1});
}

/**
* The main entry point for the application.
*
* @param args Array of parameters passed to the application
* via the command line.
*/
public static void main(String args[])
{
Application.run(new Oira());
}
}

This is the one with the problem:
import com.ms.wfc.app.*;
import com.ms.wfc.core.*;
import com.ms.wfc.ui.*;
import com.ms.wfc.html.*;

/**
* This class can take a variable number of parameters on the command
* line. Program execution begins with the main() method. The class
* constructor is not invoked unless an object of type 'MainScreen'
* created in the main() method.
*/
public class MainScreen extends Form
{
public MainScreen()
{
super();

// Required for Visual J++ Form Designer support
initForm();

// TODO: Add any constructor code after initForm call
}

/**
* MainScreen overrides dispose so it can clean up the
* component list.
*/
public void dispose()
{
super.dispose();
components.dispose();
}



private void lblNew_mouseEnter(Object source, Event e)
{
lblNew.setForeColor (Color.WHITE);
}

private void lblNew_mouseLeave(Object source, Event e)
{
lblNew.setForeColor (Color.GRAY);
}

private void MainScreen_closed(Object source, Event e)
{
System.exit(0);
}

/**
* NOTE: The following code is required by the Visual J++ form
* designer. It can be modified using the form editor. Do not
* modify it using the code editor.
*/
Container components = new Container();
PictureBox pictureBox1 = new PictureBox();
Label lblNew = new Label();

private void initForm()
{
// NOTE: This form is storing resource information in an
// external file. Do not modify the string parameter to any
// resources.getObject() function call. For example, do not
// modify "foo1_location" in the following line of code
// even if the name of the Foo object changes:
// foo1.setLocation((Point)resources.getObject("foo1_location"));

IResourceManager resources = new ResourceManager(this, "MainScreen");
this.setBackColor(Color.BLACK);
this.setText("Dark Destiny");
this.setAutoScaleBaseSize(new Point(5, 13));
this.setClientSize(new Point(600, 445));
this.setStartPosition(FormStartPosition.MANUAL);
this.setWindowState(FormWindowState.MAXIMIZED);
this.addOnClosed(new EventHandler(this.MainScreen_closed));

pictureBox1.setLocation(new Point(200, 48));
pictureBox1.setSize(new Point(245, 92));
pictureBox1.setTabIndex(0);
pictureBox1.setTabStop(false);
pictureBox1.setText("pictureBox1");
pictureBox1.setImage((Bitmap)resources.getObject("pictureBox1_image"));
pictureBox1.setSizeMode(PictureBoxSizeMode.AUTO_SIZE);

lblNew.setFont(new Font("Algerian", 16.0f, FontSize.POINTS, FontWeight.NORMAL, false, false, false, CharacterSet.DEFAULT, 0));
lblNew.setForeColor(Color.GRAY);
lblNew.setLocation(new Point(256, 200));
lblNew.setSize(new Point(120, 32));
lblNew.setTabIndex(1);
lblNew.setTabStop(false);
lblNew.setText("New Game");
lblNew.addOnMouseEnter(new EventHandler(this.lblNew_mouseEnter));
lblNew.addOnMouseLeave(new EventHandler(this.lblNew_mouseLeave));

this.setNewControls(new Control[] {
lblNew,
pictureBox1});
}

/**
* The main entry point for the application.
*
* @param args Array of parameters passed to the application
* via the command line.
*/
public static void main(String args[])
{
Application.run(new MainScreen());
}
}










privacy (GDPR)