How To Add Applet To The Frame

Aug 13, 2014

i have created a frame with a menu bar displaying contents..now i want to set a username and password to that flame through an applet how to add applet to the frame??

here is my code ..

import java.awt.*;
import java.awt.event.*;
import java.applet.*;
class MenuFrame extends Frame{
String msg="";
int flag=0;
CheckboxMenuItem debug,test;

[Code]...

View Replies


ADVERTISEMENT

Adding Applet Intro A Frame

Mar 17, 2015

Is there a way to add an applet intro a JFrame ? more exactly I have a frame and when a button is pressed it should add to the frame the applet . Here is some sample code for better understanding :

public class principal implements ActionListener{
 public static void main(String[] args) {
// code
JButton b1=new JButton("Start");
b1.setLocation(0,height-60);
b1.setSize(width,20);

[Code] ....

View Replies View Related

Cannot Add Second Component To Frame?

Apr 13, 2014

I can't seem to add second component to frame what this class creates:

package TestVersion;
import java.awt.Color;
import java.awt.Component;
import javax.swing.JFrame;
import TestVersion.CKeyListener;
import TestVersion.GameWorld;
import TestVersion.MatWood;
public class MYCoreWorld {

[Code] .....

View Replies View Related

Frame Not Displaying

Sep 20, 2014

I created a instance of a class AddItemView, inside StartUpMenuController. I then passed it into the class, the main method is below showing that as well. However when I do this:

else if(e.getSource()==menu.addBtn)
{
new addItem();
}

I get an error, little red line on the bottom of the text. I am testing the frame at the moment to make sure it is what I want before I move on to the Controller side of it. I just want to display it and go from there.

package mainMenu.Home.DataBase;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import addItemBtn.Home.DataBase.AddItemView;
public class StartUpMenuController
{
StartUpMenu menu;
AddItemView addItem;
 
[code]...

Not sure if this is the issue but the class I am making a new instance of is in a different package. I imported the package though.

View Replies View Related

How To Let A Frame Disappear And Let Another One Appear

Mar 12, 2014

i have been struggling with 2 frames.the question here is, how can you let a frame disappear and let another one appear.im making a game and when i click on start it needs to show another frame.got the whole code here:

import java.awt.Color;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
public class RushhourStart
{
public static void main(String [] args)
{
JFrame frame = new JFrame();
frame.setSize(700, 700);
frame.setTitle("Rushhour");
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(JFrame. EXIT_ON_CLOSE);
frame.setVisible(true);
 
[code]...

View Replies View Related

Moving Oval Around The Frame

Feb 3, 2014

I'm trying to understand and learn Java for GUI but I'm stacked around a project. I had done some other "test app" but on this, I can't figure out what I had done. I can't move my circle around the panel.... Where I had made some errors?

Main class
package main;
// imports
import javax.swing.JFrame;
import java.awt.Dimension;
public class Main {
public static final int WIDTH = 320;
public static final int HEIGHT = 240;
public static final int SCALE = 2;

[Code] .....

View Replies View Related

How To Get All Methods On One World Frame

Oct 17, 2014

I'm pretty new at java and I was wondering on how to get all my methods on one world frame?

The code is this:

public class TurtleTester
{
public static void main (String[] args)
{
World world= new World();
Turtle turtle= new Turtle(world);
turtle.drawRectangle(50,100);
turtle.drawHexagon(100);

[Code]...

When I run the main method, it would give me a bunch of world frames with one method in each one. I'm using BlueJ btw.

View Replies View Related

Getting And Setting Frame Name From Another Class

Aug 7, 2014

package com.simbaorka101.te.gui;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.ScrollPaneConstants;
import javax.swing.event.DocumentListener;

[code]....

This is my frame class, now I want to be able to change the name of the frame, and get the name with frame.getName() in another class. But I'm not sure how to do this, i tried making a new frame in that class but i feel it's just another frame and not the one i made, also tried something like

public JFrame getFrame(){
this.getFrame();
}

and few variations but it was wrong.

View Replies View Related

Nothing Except Frame And Label Shows Up

Apr 3, 2014

Java Code:

import java.awt.*;
import java.awt.event.*;
public class TestFrame extends Frame implements ActionListener {
static int i;
Frame fr;
Button b1,b2;
Image img[]=new Image[3];

[Code] .....

View Replies View Related

Swing/AWT/SWT :: Frame And Panels

Nov 30, 2014

I wrote the following code to get a frame,button in south and a red color circle,which i got.In the "actionPerformed" method i wrote "setContentPane(mp2)" thinking it would put another panel on the frame with a blue circle but when i pushed the button,the button got stuck and the circled did not change.

import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Fra implements ActionListener
{
MyPanel2 mp2;
JFrame frame;
JButton button;
public static void main(String[] args)

[Code] .....

View Replies View Related

How To Add Background Image To Frame

Mar 20, 2014

I'm using notepad++

I want add background Image

View Replies View Related

JLabel Will Not Show Up In Frame

Apr 5, 2014

So Im making a game with a start screen followed by my game. I have a button centered but Im having a hard time displaying my label. Here's my code:

import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
 import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JFrame;
 public class TitleScreen extends JPanel implements ActionListener{
 
[Code] ....

View Replies View Related

How To Pass Values To A New Frame

Nov 28, 2014

I'm new to Java and I'm trying to pass several values from one frame to another. I've searched around and most codes I've come across are from auto generated GUI code. This what I've been trying to do

Frame1

private class SubmitButtonListener implements ActionListener {
public void actionPerformed (ActionEvent e) {
Frame2 f2 = new Frame2();
//call setValue from Frame2
f2.setValue(4.0);
f2.setVisible(true);
}
}

Frame2

private double val;
public double getvalue()
{
return val;
}
public void setValue(double v)

[code]...

View Replies View Related

JLabel Not Displaying In Frame

Apr 5, 2014

So Im making a game with a start screen followed by my game. I have a button centered but Im having a hard time displaying my label. Here's my code:

import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JFrame;

public class TitleScreen extends JPanel implements ActionListener{

[Code] ....

View Replies View Related

Possible To Dispose Internal Frame

Nov 20, 2014

Is it possible to dispose(); an internal frame and keep my main JFrame open.

View Replies View Related

Error While Moving The Tiles In Frame

Jan 17, 2014

I was following a tutorial on how to make a game when i suddenly got an error concerning moving tiles. i get this error when i tried to use a and d to move:

Exception in thread "Display" java.lang.ArrayIndexOutOfBoundsException: 48600
at com.cherno.graphics.Screen.render(Screen.java:44)
at com.cherno.Game.render(Game.java:124)
at com.cherno.Game.run(Game.java:87)
at java.lang.Thread.run(Unknown Source)

I do not get the error while using w or s but the tiles are still not moving when pressing them.

I have three classes at work here.

The main, Game.java;

package com.cherno;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.image.BufferStrategy;

[Code] .....

View Replies View Related

Java Frame Window Using Button

Jan 21, 2014

How one frame to another frame using button ?

View Replies View Related

How To Get Keyboard Input Without Focus On The Frame

Jan 29, 2015

so i'm working in a chat program and i'm trying to make it so that you are able to open another tab yet still be able to chat.

right now the client that the user download uses the keyadapter to get the keyboard input, but whenever the user un-focus the chat window, the keyadapter no longer gets the keyboard input.so is there another way i can get the keyboard input? so it doesn't matter what window you are focused on, you get the keyboard input either way?

View Replies View Related

Swing/AWT/SWT :: How To Paint Image On Frame

Mar 8, 2015

I simply want to paint an image on my frame, just once each time the paint() method is called, but how to call the paint method in any good way. This is how it looks:

import java.awt.AWTException;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;

[Code] ....

I have a frame in another class, and from my assumption I need to somehow tell my paint method to paint on that specific frame right?

View Replies View Related

Guessing Game - Won't Add Buttons To Frame

Aug 6, 2014

I have a guessing game that im working on but it wont add my buttons to the frame, why?

// GuessGame.java
// Guess the number
import javax.swing.JFrame;
public class GuessGame extends JFrame {
public static void main(String args[]) {
GuessGame panel = new GuessGame();
panel.setSize(400,350);

[Code] ...

The window pull up and even in the design view it shows everything on there but when i run its just a blank window.

View Replies View Related

Multiple Frames In Single Frame

Apr 3, 2014

i want to know how i can add more than one frame in a single frame means main window or frame will be constant and only components will be chang or vary as in a software or game .

View Replies View Related

Draw Panel On A Frame - Can't See JPanel

Apr 14, 2015

I've been trying to draw a panel on a frame with simple drawString drawRect and oval but when i run it the frame shows up with the exit on close stuff but nothing will show inside . this is my code :

import java.awt.Graphics;
import javax.swing.JPanel;
import javax.swing.JFrame;
class Draw extends JPanel{
public void paintcomponents(Graphics g){
super.paintComponent(g);
g.drawLine(10,15,20,30);

[Code] .....

I'm not sure what's wrong , probably something to do from this pc ? since in the lab work at uni it worked fine .

View Replies View Related

Calling Internal Frame In Java

Jul 14, 2014

Any way I can call an internal Frame in java by clicking a button in separate internal Frame to display in a panel in Main JFrame....

View Replies View Related

Changing Color Of Frame Of Windows

May 2, 2014

In the image, the color of the frame of the window/JFrame is black. My question is that can we set the color of this frame, or is it just provided by the operating system and whatever color is default color of windows in an operating system will appear in our application?

I am talking about the frame, the boundary in the JFrame container which contains the close, maximize, and minimize buttons.

View Replies View Related

Components Not Shown Until Resize Frame

Mar 8, 2014

My components dont show until I resize the frame.

public class Frame extends JFrame{
 private final static int WIDTH=400, HEIGHT=400;
public Frame(){
super();
super.setSize(WIDTH,HEIGHT);
super.setVisible(true);

[Code] ....

In my main class I am just creating the frame and the panel then adding the panel to the frame.

View Replies View Related

Any Alternatives To JFrame That Can Be Used As Parent Frame?

Mar 2, 2014

Are there any alternatives to JFrame that can be used as a parent Frame?

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved