Java Windows question..

J

JTapio

Hei!

I have an homepage www.eurojari.net containing an applet runnable..
if i add an image to my applet witch has an question of yes or no 'shall we
open a window' then,
how to i:
open fullscreen sized window ready to receive Graphics2D commands from my
applet run()..

thank you for helping a relative new person on java, c is more familiar to
me but net and java is quite a new..
very much thank you..

Yours : JariTapio
Homepage : www.EuroJari.net
EMail : (e-mail address removed)
 
A

Andrew Thompson

JTapio wrote:
....
I have an homepage www.eurojari.net containing an applet runnable..

...hmmm. After visiting your homepage, and waiting several
minutes for the multitude of images and resources to load,
I saw a message about how this site was best viewed at
some 'screen resolution', and left.

I realise you were not asking us to critique the homepage, but
I will. Remove most of the images, or include tiny versions
(in both WxH and bytes) on the homepage, but link to large versions.

Move the applet from the homepage, onto a page where the user
is warned to expect to 'wait a few moment' for it to load, or better,
load it using webstart in a free floating window.

Designing for a particular screen size fell out of fashion last
millenium, make web sites for the users' screen size instead.

The bottom line of the web page (re., updates) has a typo.
if i add an image to my applet witch has an question of yes or no 'shall we
open a window' then,
how to i:
open fullscreen sized window

<sscce>
import java.awt.*;
import java.applet.*;

public class AppletWindow extends Applet {
public void init() {
Frame f = Frame.getFrames()[0];
Window w = new Window(f);
w.setSize(
Toolkit.getDefaultToolkit().getScreenSize() );
w.setVisible(true);
}
}
.... ready to receive Graphics2D commands from my
applet run()..

Is this an Applet or JApplet?

Andrew T.
 
J

JTapio

Andrew Thompson said:
JTapio wrote:
...

..hmmm. After visiting your homepage, and waiting several
minutes for the multitude of images and resources to load,
I saw a message about how this site was best viewed at
some 'screen resolution', and left.

my images are something like 80k - 90k .jpg format.. their temporary on my
page, for my friends..
but, several minutes, man, ADSL is not that expensive anymore on these days,
and trust me it is worth of that 19e a month what it costs..
thank you for the function, anyway..
import java.awt.*;
import java.applet.*;

public class AppletWindow extends Applet {
public void init() {
Frame f = Frame.getFrames()[0];
Window w = new Window(f);
w.setSize(
Toolkit.getDefaultToolkit().getScreenSize() );
w.setVisible(true);
}
}
Is this an Applet or JApplet?

i dont have that deep knowledge of Java, im more like c++, but i think your
asking am i using a swing or awt applet..
i would love to keep it simple, so just fullscreen window ready to receive
images and some shapes..
and that would be fine..

thank you..

Yours : JariTapio
Homepage : www.EuroJari.net
EMail : (e-mail address removed)
 
A

Andrew Thompson

JTapio said:
...
my images are something like 80k - 90k .jpg format.. their temporary on my
page, for my friends..

So given we are not your friends, and you are
after technical help, I will point out that..
but, several minutes, man, ADSL is not that expensive anymore on these days,

...neither is help from a help desk, or e-lance, or any
other number of sources of specialised help, whereas
the advantage of posting to usenet is that help is not just
cheap, it's *free*.
and trust me it is worth of that 19e a month what it costs..

Wherever "e's" are considered currency, it is not here, and
is not relevant to here, but even mroe importantly, you are
suggesting I pay (extra) money, just to help you out, for free?!?
thank you for the function, anyway..
Yeh..


i dont have that deep knowledge of Java, im more like c++, but i think your
asking am i using a swing or awt applet..
i would love to keep it simple, so just fullscreen window ready to receive
images and some shapes..
and that would be fine..

Ummm.. and how much were you offering for this piece
of ('simple') specialist coding? (Read - 'See elance').

Andrew T.
 
J

JTapio

Jep!

I think i need a good tutorial here,
would please receive few links, in need to get familiar with window opening,
sizening and drawing images on it..

Yours : JariTapio
Homepage : www.EuroJari.net
EMail : (e-mail address removed)
 
J

JTapio

Hei!

Java Sun is quite a too heavy reading for me who dont that much have studiet
foreign languages..
i need a some kind of a for dummies page or an advice in a post..

if i have an Applet start() stop() run() init () destroy() paint() on Opera
browser..

well, i just need the SIMPLEST fullscreen sizeble frame/window (hmm, how
their different) with capabilities to receive a g.drawLine ( 0,0,100,100 )
function..

Yours : JariTapio
Homepage : www.EuroJari.net
EMail : (e-mail address removed)
 
J

JTapio

Hei!

this is how far i have get..
please help to add canvas to frame..

public void init()
{
Canvas canvas = new myComponent ();
canvas.addComponentListener( new ComponentListener ()); // this line
needs help..
frame.add (canvas);
}



class myComponent extends Canvas {
// This method is called whenever the contents needs to be
painted


public void paint(Graphics g) {
// Retrieve the graphics context; this object is used to
paint shapes
Graphics2D g2d = (Graphics2D)g;

// Draw an oval that fills the window
int x = 0;
int y = 0;
int width = getSize().width-1;
int height = getSize().height-1;
g2d.drawOval(x, y, width, height);
}

}
 
A

Andrew Thompson

JTapio wrote:
.....
this is how far i have get..
please help to add canvas to frame..

Why do you want to create the canvas in the applet,
rather than simply make it in the frame?

(Note that if overriding 'paint' I will usually choose a
Container, since there is often no need for anything more.)
public void init()
{
Canvas canvas = new myComponent ();
canvas.addComponentListener( new ComponentListener ()); // this line
needs help..

What is the purpose of listening to the canvas?

(I have done similar things, but until I understand exactly
what you are trying to do, what it looks like in the applet,
and what actions cause the frame/window to appear - I
cannot help much)

As an aside, the difference between a frame and a window
is that a window has no decorations - no 'title bar',
no 'close box'..

The code example I posted earlier in the thread, showed a
full-screen window popping from an applet (which is quite
bad if it has no button to close it & the way I did it, meant
the user could not get back to the web page with the applet!).

Andrew T.
 
J

JTapio

--(I have done similar things, but until I understand exactly
--what you are trying to do, what it looks like in the applet,
--and what actions cause the frame/window to appear - I
--cannot help much)

Hei!

if you look my homepage you can see an applet..
my applet is only for options and opening graphics..
my plan is to make a fullscreen window or frame (i dont know either is
better) from this applet, then i mouselisten and keyboard listen this
window/frame and then but my warboard graphics on it..

this is very basic information of Java but im a visualc++ programmer, dont
that much of a own the depthness of Java..

Yours : JariTapio
Homepage : www.EuroJari.net
EMail : (e-mail address removed)
 
A

Andrew Thompson

JTapio said:
--(I have done similar things, but until I understand exactly
--what you are trying to do, what it looks like in the applet,
--and what actions cause the frame/window to appear - I
--cannot help much) ....
my applet is only for options and opening graphics..
my plan is to make a fullscreen window or frame (i dont know either is
better) from this applet, then i mouselisten and keyboard listen this
window/frame and then but my warboard graphics on it..

Since the game play ends up with a free floating window,
I think you should abandon the applet entirely and
use webstart to launch the game.

You might have the options 'panel' appear in a JOptionPane
before the game appears, but better might be putting it into a
floatable JToolBar on one edge of the game play area, or
showing it whenever a menu item is selected.

For the 'floating game area' a frame (JFrame) would probably
be better than a JWindow, since a JFrame is more what
the user expects, and can be resized to full screen if they
want.

As far as the game goes, I would paint it in a Container that
I then add to the other things (like the JFrame).

But having the applet itself, makes no sense to me.

Andrew T.
 
A

Andrew Thompson

JTapio said:
You can feel safe and fine,with applet..

I feel 'safer and finer' with a sandboxed web start application*.
There is really no difference in security.

Compare the sandboxed/all-permissions end-user difference.
Sandboxed <http://www.physci.org/pc/jtest.jnlp>
all-permissions <http://www.physci.org/giffer/giffer.jnlp>
(both those were written and 'published' by me, though the
second hooks into an open source GIF animation library.)

* I use IE, and have not bothered to remove the 3810 MSVM.
If my settings get messed up and I cruise into a malicious
page with the MSVM as the default VM, the web master
has the potential to find the root location of the (MS) VM
installation on my PC, using a *sandboxed* applet.
That would not be possible with a sandboxed web start
application or applet (or any other VM).

Andrew T.
 
J

JTapio

Hei!

heh, i get my Jframe visible..
now the problem is that my applet crashes on my homepage..
my project works fine with NetBeans IDE, but, crashes on my homepage..

can you please point the problem..

import java.applet.Applet;
import java.awt.Canvas;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Toolkit;
import javax.swing.JFrame;


public class NewApplet extends Applet
{
JFrame frame;

public void init()
{
frame.setDefaultLookAndFeelDecorated(true);
frame = new JFrame("my very first frame..");

BSMCanvas region = new BSMCanvas();

frame.add(region);
frame.setSize(Toolkit.getDefaultToolkit().getScreenSize());
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);

}

public void stop ()
{}
public void destroy ()
{}

public void run ()
{

}
}

class BSMCanvas extends Canvas
{
public BSMCanvas ()
{
setSize(800, 800);
setBackground(Color.blue);
}

public void paint(Graphics g){
update(g);
}

public void update(Graphics g){
Graphics2D g2 = (Graphics2D)g;
}
}


Yours : JariTapio
Homepage : www.EuroJari.net
EMail : (e-mail address removed)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,265
Latest member
TodLarocca

Latest Threads

Top