Draw window
hi,
i not sure how to start create the window in my form. i tried to right click and create new window but it doesn't seem to let me adjust the size. can advise how to create window?
thanks
Hi,
For creating new windows
Choose Edit -> Create element to add new window names and types to the list.
A dialog box appears.
Enter a window name and description.
Input-enabled fields are displayed in the lower half of the screen. The field Description receives the value from the dialog box, the value for the field Window type is set by the system.
By default, the system sets VAR as the window type for windows with variable contents. If you prefer another window type, simply overwrite this value.
Make your entries or changes.
You can define one standard paragraph per window in the field Default paragraph.
Defining Page Windows
To define a page window, allocate a logical window to a physical page and specify the position and size of the window (the window is logical, because you define it only once in the entire form by specifying name and type, but not its usage). However, the size is limited by the page format selected in the header data.
Ø Choose Goto à Page windows.
Ø Choose Edit à Create element.
A list of defined logical windows appears.
Select the desired window from the list.
Enter valid values in the fields displayed in the lower half of the screen. The unit of measurement is set by the system.
Specify the position of the selected window on the page and the dimensions of the window.
Ø To define page windows for the next page, you must first select the next page.
Ø Choose Goto à Pages and select the next page.
Ø Then choose Goto à Page windows and repeat the steps above.
Ø Save your form.
Ø To delete a selected element, choose Edit à Delete.
Repeat these steps for each of your windows.
Hope it helps.
Suruchi
Similar Messages
-
can some one please help me i am trying to do my courswork on windows i need to use the drawing window but everytime i try to compile my code through command promt i get a message saying
D:\>javac DrawLine.java
DrawLine.java:1: package element does not exist
import element.*;
^
DrawLine.java:7: cannot find symbol
symbol : class ConsoleWindow
location: class DrawLine
ConsoleWindow c = new ConsoleWindow();
^
DrawLine.java:7: cannot find symbol
symbol : class ConsoleWindow
location: class DrawLine
ConsoleWindow c = new ConsoleWindow();
^
DrawLine.java:8: cannot find symbol
symbol : class DrawingWindow
location: class DrawLine
DrawingWindow d = new DrawingWindow();
^
DrawLine.java:8: cannot find symbol
symbol : class DrawingWindow
location: class DrawLine
DrawingWindow d = new DrawingWindow();
^
DrawLine.java:9: cannot find symbol
symbol : class Pt
location: class DrawLine
Pt pressPoint, releasePoint;
^
DrawLine.java:16: cannot find symbol
symbol : class Line
location: class DrawLine
d.draw(new Line(pressPoint,releasePoint));
^
7 errors
and this is the code that i am using
import element.*;
public class DrawLine
public static void main(String args[])
ConsoleWindow c = new ConsoleWindow();
DrawingWindow d = new DrawingWindow();
Pt pressPoint, releasePoint;
c.out.println("Press the mouse, drag out a line, and release!");
d.awaitMousePress();
pressPoint = d.getMouse();
d.awaitMouseRelease();
releasePoint = d.getMouse();
d.draw(new Line(pressPoint,releasePoint));
}Re: getting the name right: check the documentation and make sure you have it right!
Re: the classpath, it depends on BlueJ. I have no idea how that works. But if it's like any other IDE I've ever seen, you have some kind of "project" attribute (to your IDE or project, not to the classes you're writing) or tab or menu item, and from there you can configure the project. One of the things you can configure is the class path. The element.* classes probably are in a jar file. So the IDE probably has a way to add that jar file to the class path.
Check your documentation. -
[SOLVED]Emerald/compiz draws window decoration around conky...
Hi! I've recently installed conky for the first time ever and wish to use it as a simple clock. I have edited the .conkyrc to achieve this, however when I start conky, compiz draws the emerald theme around my conky clock.
Having looked around the web, a common suggestion seems to be to add:
!(name=conky)
To my Window Decoration Window Matching config (it's usually set to "Any") in order to exclude conky from having window decorations drawn. Unfortuntely, this doesn't work.
Another suggestion was to add "-conky" to "Any", giving me:
any -conky
However, this removes window decorations from ALL windows.
Here is my conky config:
# set to yes if you want tormo to be forked in the background
background no
cpu_avg_samples 2
net_avg_samples 2
out_to_console no
own_window_type normal
# X font when Xft is disabled, you can pick one with program xfontsel
#font 7x12
#font *mintsmild.se*
# Use Xft?
use_xft yes
# Xft font when Xft is enabled
xftfont AvantGarde LT Medium:size=16
# Text alpha when using Xft
xftalpha 0.8
# mail spool
mail_spool $MAIL
# Update interval in seconds
update_interval 1
# Create own window instead of using desktop (required in nautilus)
own_window yes
# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes
# MPD host/port
mpd_host heaton
mpd_port 6600
# Minimum size of text area
minimum_size 230 5
maximum_width 230
# Draw shades?
draw_shades no
# Draw outlines?
draw_outline no
# Draw borders around text
draw_borders no
# Stippled borders?
stippled_borders no
# border margins
border_margin no
# border width
border_width no
# Default colors and also border colors
default_color white
default_shade_color black
default_outline_color black
# Text alignment, other possible values are commented
#alignment top_left
#alignment top_right
alignment bottom_left
#alignment bottom_right
# Gap between borders of screen and text
gap_x 13
gap_y 7
# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer no
# Subtract file system buffers from used memory?
no_buffers yes
# set to yes if you want all text to be in uppercase
uppercase no
# stuff after 'TEXT' will be formatted on screen
TEXT
${color #ffffff}${time %H}${color #ffffff}${time %M}
Any help would be appreciated thank you.
/izo\
Last edited by Izobalax (2008-07-18 15:11:33)Ashren wrote:Put this is: "own_window_hints undecorated,below,skip_taskbar,skip_pager,sticky" in your .conkyrc.
You sir/madam, are an absolute star. May kisses rain on you from Heaven always.
I only have one problem left.
My clock text is surrounded in a block of black background. How do I remove this so that the text stands purely on it's own, with a transparent background?
/izo\ -
Drawing window borders swing look and feel
Does anyone know how to change the frame window border from being drawn in the windows look and feel? I want them to be drawn as a swing application. Can anyone help?
Frames (and JFrames) are top-level containers that are not subject to rendering by the Look-and-Feel manager (they are actually "heavy-weight" native components). However, in 1.4 it is possible to use an undecorated frame (using Frame.setUndecorated(true)) which you could paint to look like a JInternalFrame. However, I think you lose the automatic handling of resizing, moving, iconifying, maximizing, closing, etc.
-
A java drawing window application- free hand draw problem
i am using mouseDragged() for painting free hand draw, it works fine if one drag mouse slowly but line breaks if mouse is dragged quickly
eg
public void mouseDragged(MouseEvent me)
msX=me.getX();
msY=me.getY();
repaint();
do not works smoothly
may any body help it?Maybe if you have an old point and a new point, draw a line between the points, then make the new point the old one.
-
Drawing a picture within JFrame when I've already created a JFrame
Hi everyone,
I was wondering if you could help me out with this problem I'm getting. I'm creating a program to simulate an 'elevator.' When first creating the project I created a brand new 'Java GUI Form' : 'JFrame Form'. From here I went on to drag-and-drop various command buttons and labels to create the user interface (the 'inside' of an elevator). Here is where my question comes in. On the very left of my interface I want to have the program draw a simulation of a box (the elevator) moving up and down with the 'floor numbers' the user pushes. However i don't know how to access the coding of the jFrame object that I created through the design editor so i can input the coding.
First Question: What do i have to 'write' that would force that box to print into the current JFrame?
Second Question: What Code (and where do i put it) essentially 'locks' the JFrame from being resized?Here, maybe by putting this it might help you recognize what i'm trying to say. The code i'm trying to put in is:
JFrame window = new JFrame ("Drawing");
window.setBounds(200,200,700,500);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setVisible(true);
Container contentPane = window.getContentPane();
contentPane.setBackground(new Color(125, 125, 125));
Graphics g = contentPane.getGraphics();* This is a portion of the code
When run, this program creates a NEW JFRAME WINDOWS, i'm trying to make it run inside an already existing JFrame, whose variable Name i dont know how to find. -
Gtk-window-decorator doesn't show window decor for background windows
I've gotten Compiz install and working fine except where gtk-window-decorator is concerned. It starts ok, but it only draws window decoration for windows in focus. The area where the decoration should be is clickable and brings the window into focus. Occasionally there is corrupt graphics where the background windows decoration should be.
Here is my xorg.conf
Section "ServerLayout"
# Serial Mouse not detected
# USB Mouse not detected
Identifier "Xorg Configured"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "PS/2 Mouse" "CorePointer"
EndSection
Section "Files"
# Additional fonts: Locale, Gimp, TTF...
# FontPath "/usr/share/lib/X11/fonts/latin2/75dpi"
# FontPath "/usr/share/lib/X11/fonts/latin2/100dpi"
# True type and type1 fonts are also handled via xftlib, see /etc/X11/XftConfig!
# FontPath "/usr/share/fonts/75dpi:unscaled"
# FontPath "/usr/share/fonts/75dpi"
RgbPath "/usr/share/X11/rgb"
ModulePath "/usr/lib/xorg/modules"
FontPath "/usr/share/fonts/misc:unscaled"
FontPath "/usr/share/fonts/misc"
FontPath "/usr/share/fonts/100dpi:unscaled"
FontPath "/usr/share/fonts/100dpi"
FontPath "/usr/share/fonts/PEX"
FontPath "/usr/share/fonts/cyrillic"
FontPath "/usr/share/fonts/Type1"
FontPath "/usr/share/fonts/ttf/western"
FontPath "/usr/share/fonts/ttf/decoratives"
FontPath "/usr/share/fonts/truetype"
FontPath "/usr/share/fonts/truetype/openoffice"
FontPath "/usr/share/fonts/truetype/ttf-bitstream-vera"
FontPath "/usr/share/fonts/latex-ttf-fonts"
FontPath "/usr/share/fonts/defoma/CID"
FontPath "/usr/share/fonts/defoma/TrueType"
EndSection
Section "Module"
Load "ddc" # ddc probing of monitor
Load "dbe"
Load "extmod"
Load "glx"
Load "bitmap" # bitmap-fonts
Load "freetype"
Load "record"
# Load "synaptics"
EndSection
Section "ServerFlags"
Option "AllowMouseOpenFail" "true"
Option "Xinerama" "0"
EndSection
Section "InputDevice"
Identifier "Keyboard0"
Driver "keyboard"
Option "CoreKeyboard"
Option "XkbRules" "xorg"
Option "XkbModel" "apple"
Option "XkbLayout" "gb"
Option "XkbVariant" ""
EndSection
Section "InputDevice"
Identifier "Serial Mouse"
Driver "mouse"
Option "Protocol" "Microsoft"
Option "Device" "/dev/ttyS0"
Option "Emulate3Buttons" "true"
Option "Emulate3Timeout" "70"
Option "SendCoreEvents" "true"
EndSection
Section "InputDevice"
Identifier "PS/2 Mouse"
Driver "mouse"
Option "Protocol" "auto"
Option "ZAxisMapping" "4 5"
Option "Device" "/dev/psaux"
Option "Emulate3Buttons" "true"
Option "Emulate3Timeout" "70"
Option "SendCoreEvents" "true"
EndSection
Section "InputDevice"
Identifier "USB Mouse"
Driver "mouse"
Option "Device" "/dev/input/mice"
Option "SendCoreEvents" "true"
Option "Protocol" "IMPS/2"
Option "ZAxisMapping" "4 5"
Option "Buttons" "5"
EndSection
Section "Monitor"
Identifier "226BW"
# DisplaySize 474 296
HorizSync 28.0 - 96.0
VertRefresh 50.0 - 62.0
# ModeLine "1680x1050_60.00" 147.1 1680 1784 1968 2256 1050 1051 1054 1087 -hsync +vsync
Option "DPMS" "true"
EndSection
Section "Monitor"
Identifier "Monitor0"
VendorName "Unknown"
ModelName "Samsung SyncMaster"
HorizSync 30.0 - 81.0
VertRefresh 56.0 - 75.0
EndSection
Section "Device"
Identifier "8800GTS320"
Driver "nvidia"
VendorName "BGS"
BoardName "Geforce 8800GTS 320MB"
# Option "UseEdidDpi" "false"
# Option "DPI" "90x90"
Option "RenderAccel" "True"
Option "AddARGBGLXVisuals" "True"
Option "DamageEvents" "True"
Option "TripleBuffer" "True"
EndSection
Section "Device"
Identifier "Videocard0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BoardName "GeForce 8800 GTS"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Videocard0"
Monitor "Monitor0"
DefaultDepth 24
Option "TwinView" "0"
Option "metamodes" "1680x1050_60 +0+0; nvidia-auto-select +0+0"
SubSection "Display"
Depth 24
EndSubSection
EndSection
Section "Extensions"
Option "Composite" "enable"
EndSection
and the output of glxinfo:
name of display: :0.0
display: :0 screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
server glx extensions:
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig,
GLX_SGIX_pbuffer, GLX_SGI_video_sync, GLX_SGI_swap_control,
GLX_EXT_texture_from_pixmap, GLX_ARB_multisample, GLX_NV_float_buffer,
GLX_ARB_fbconfig_float, GLX_EXT_framebuffer_sRGB
client glx vendor string: NVIDIA Corporation
client glx version string: 1.4
client glx extensions:
GLX_ARB_get_proc_address, GLX_ARB_multisample, GLX_EXT_visual_info,
GLX_EXT_visual_rating, GLX_EXT_import_context, GLX_SGI_video_sync,
GLX_NV_swap_group, GLX_NV_video_out, GLX_SGIX_fbconfig, GLX_SGIX_pbuffer,
GLX_SGI_swap_control, GLX_NV_float_buffer, GLX_ARB_fbconfig_float,
GLX_EXT_fbconfig_packed_float, GLX_EXT_texture_from_pixmap,
GLX_EXT_framebuffer_sRGB
GLX version: 1.3
GLX extensions:
GLX_EXT_visual_info, GLX_EXT_visual_rating, GLX_SGIX_fbconfig,
GLX_SGIX_pbuffer, GLX_SGI_video_sync, GLX_SGI_swap_control,
GLX_EXT_texture_from_pixmap, GLX_ARB_multisample, GLX_NV_float_buffer,
GLX_ARB_fbconfig_float, GLX_EXT_framebuffer_sRGB,
GLX_ARB_get_proc_address
OpenGL vendor string: NVIDIA Corporation
OpenGL renderer string: GeForce 8800 GTS/PCI/SSE2
OpenGL version string: 2.1.2 NVIDIA 169.09
OpenGL extensions:
GL_ARB_color_buffer_float, GL_ARB_depth_texture, GL_ARB_draw_buffers,
GL_ARB_fragment_program, GL_ARB_fragment_program_shadow,
GL_ARB_fragment_shader, GL_ARB_half_float_pixel, GL_ARB_imaging,
GL_ARB_multisample, GL_ARB_multitexture, GL_ARB_occlusion_query,
GL_ARB_pixel_buffer_object, GL_ARB_point_parameters, GL_ARB_point_sprite,
GL_ARB_shadow, GL_ARB_shader_objects, GL_ARB_shading_language_100,
GL_ARB_texture_border_clamp, GL_ARB_texture_compression,
GL_ARB_texture_cube_map, GL_ARB_texture_env_add,
GL_ARB_texture_env_combine, GL_ARB_texture_env_dot3, GL_ARB_texture_float,
GL_ARB_texture_mirrored_repeat, GL_ARB_texture_non_power_of_two,
GL_ARB_texture_rectangle, GL_ARB_transpose_matrix,
GL_ARB_vertex_buffer_object, GL_ARB_vertex_program, GL_ARB_vertex_shader,
GL_ARB_window_pos, GL_ATI_draw_buffers, GL_ATI_texture_float,
GL_ATI_texture_mirror_once, GL_S3_s3tc, GL_EXT_texture_env_add,
GL_EXT_abgr, GL_EXT_bgra, GL_EXT_blend_color,
GL_EXT_blend_equation_separate, GL_EXT_blend_func_separate,
GL_EXT_blend_minmax, GL_EXT_blend_subtract, GL_EXT_compiled_vertex_array,
GL_EXT_Cg_shader, GL_EXT_bindable_uniform, GL_EXT_depth_bounds_test,
GL_EXT_draw_buffers2, GL_EXT_draw_instanced, GL_EXT_draw_range_elements,
GL_EXT_fog_coord, GL_EXT_framebuffer_blit, GL_EXT_framebuffer_multisample,
GL_EXT_framebuffer_object, GL_EXTX_framebuffer_mixed_formats,
GL_EXT_framebuffer_sRGB, GL_EXT_geometry_shader4,
GL_EXT_gpu_program_parameters, GL_EXT_gpu_shader4,
GL_EXT_multi_draw_arrays, GL_EXT_packed_depth_stencil,
GL_EXT_packed_float, GL_EXT_packed_pixels, GL_EXT_pixel_buffer_object,
GL_EXT_point_parameters, GL_EXT_rescale_normal, GL_EXT_secondary_color,
GL_EXT_separate_specular_color, GL_EXT_shadow_funcs,
GL_EXT_stencil_two_side, GL_EXT_stencil_wrap, GL_EXT_texture3D,
GL_EXT_texture_array, GL_EXT_texture_buffer_object,
GL_EXT_texture_compression_latc, GL_EXT_texture_compression_rgtc,
GL_EXT_texture_compression_s3tc, GL_EXT_texture_cube_map,
GL_EXT_texture_edge_clamp, GL_EXT_texture_env_combine,
GL_EXT_texture_env_dot3, GL_EXT_texture_filter_anisotropic,
GL_EXT_texture_integer, GL_EXT_texture_lod, GL_EXT_texture_lod_bias,
GL_EXT_texture_mirror_clamp, GL_EXT_texture_object, GL_EXT_texture_sRGB,
GL_EXT_texture_shared_exponent, GL_EXT_timer_query, GL_EXT_vertex_array,
GL_IBM_rasterpos_clip, GL_IBM_texture_mirrored_repeat,
GL_KTX_buffer_region, GL_NV_blend_square, GL_NV_copy_depth_to_color,
GL_NV_depth_buffer_float, GL_NV_conditional_render, GL_NV_depth_clamp,
GL_NV_fence, GL_NV_float_buffer, GL_NV_fog_distance,
GL_NV_fragment_program, GL_NV_fragment_program_option,
GL_NV_fragment_program2, GL_NV_framebuffer_multisample_coverage,
GL_NV_geometry_shader4, GL_NV_gpu_program4, GL_NV_half_float,
GL_NV_light_max_exponent, GL_NV_multisample_coverage,
GL_NV_multisample_filter_hint, GL_NV_occlusion_query,
GL_NV_packed_depth_stencil, GL_NV_parameter_buffer_object,
GL_NV_pixel_data_range, GL_NV_point_sprite, GL_NV_primitive_restart,
GL_NV_register_combiners, GL_NV_register_combiners2,
GL_NV_texgen_reflection, GL_NV_texture_compression_vtc,
GL_NV_texture_env_combine4, GL_NV_texture_expand_normal,
GL_NV_texture_rectangle, GL_NV_texture_shader, GL_NV_texture_shader2,
GL_NV_texture_shader3, GL_NV_transform_feedback, GL_NV_vertex_array_range,
GL_NV_vertex_array_range2, GL_NV_vertex_program, GL_NV_vertex_program1_1,
GL_NV_vertex_program2, GL_NV_vertex_program2_option,
GL_NV_vertex_program3, GL_NVX_conditional_render, GL_SGIS_generate_mipmap,
GL_SGIS_texture_lod, GL_SGIX_depth_texture, GL_SGIX_shadow,
GL_SUN_slice_accum
visual x bf lv rg d st colorbuffer ax dp st accumbuffer ms cav
id dep cl sp sz l ci b ro r g b a bf th cl r g b a ns b eat
0x21 24 tc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 0 0 None
0x22 24 dc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 0 0 None
0x24 24 tc 0 32 0 r y . 8 8 8 8 4 24 8 16 16 16 16 0 0 None
0x25 24 tc 0 32 0 r . . 8 8 8 0 4 24 8 16 16 16 16 0 0 None
0x26 24 tc 0 32 0 r . . 8 8 8 8 4 24 8 16 16 16 16 0 0 None
0x27 24 tc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 0 0 None
0x28 24 tc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 0 0 None
0x29 24 tc 0 32 0 r . . 8 8 8 0 4 24 0 16 16 16 16 0 0 None
0x2a 24 tc 0 32 0 r . . 8 8 8 8 4 24 0 16 16 16 16 0 0 None
0x2b 24 tc 0 32 0 r y . 8 8 8 0 4 0 0 16 16 16 16 0 0 None
0x2c 24 tc 0 32 0 r y . 8 8 8 8 4 0 0 16 16 16 16 0 0 None
0x2d 24 tc 0 32 0 r . . 8 8 8 0 4 0 0 16 16 16 16 0 0 None
0x2e 24 tc 0 32 0 r . . 8 8 8 8 4 0 0 16 16 16 16 0 0 None
0x2f 24 tc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 2 1 Ncon
0x30 24 tc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 2 1 Ncon
0x31 24 tc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 4 1 Ncon
0x32 24 tc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 4 1 Ncon
0x33 24 tc 0 32 0 r . . 8 8 8 0 4 24 0 16 16 16 16 2 1 Ncon
0x34 24 tc 0 32 0 r . . 8 8 8 8 4 24 0 16 16 16 16 2 1 Ncon
0x35 24 tc 0 32 0 r . . 8 8 8 0 4 24 0 16 16 16 16 4 1 Ncon
0x36 24 tc 0 32 0 r . . 8 8 8 8 4 24 0 16 16 16 16 4 1 Ncon
0x37 24 tc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 2 1 Ncon
0x38 24 tc 0 32 0 r y . 8 8 8 8 4 24 8 16 16 16 16 2 1 Ncon
0x39 24 tc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 4 1 Ncon
0x3a 24 tc 0 32 0 r y . 8 8 8 8 4 24 8 16 16 16 16 4 1 Ncon
0x3b 24 tc 0 32 0 r . . 8 8 8 0 4 24 8 16 16 16 16 2 1 Ncon
0x3c 24 tc 0 32 0 r . . 8 8 8 8 4 24 8 16 16 16 16 2 1 Ncon
0x3d 24 tc 0 32 0 r . . 8 8 8 0 4 24 8 16 16 16 16 4 1 Ncon
0x3e 24 tc 0 32 0 r . . 8 8 8 8 4 24 8 16 16 16 16 4 1 Ncon
0x3f 24 dc 0 32 0 r y . 8 8 8 8 4 24 8 16 16 16 16 0 0 None
0x40 24 dc 0 32 0 r . . 8 8 8 0 4 24 8 16 16 16 16 0 0 None
0x41 24 dc 0 32 0 r . . 8 8 8 8 4 24 8 16 16 16 16 0 0 None
0x42 24 dc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 0 0 None
0x43 24 dc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 0 0 None
0x44 24 dc 0 32 0 r . . 8 8 8 0 4 24 0 16 16 16 16 0 0 None
0x45 24 dc 0 32 0 r . . 8 8 8 8 4 24 0 16 16 16 16 0 0 None
0x46 24 dc 0 32 0 r y . 8 8 8 0 4 0 0 16 16 16 16 0 0 None
0x47 24 dc 0 32 0 r y . 8 8 8 8 4 0 0 16 16 16 16 0 0 None
0x48 24 dc 0 32 0 r . . 8 8 8 0 4 0 0 16 16 16 16 0 0 None
0x49 24 dc 0 32 0 r . . 8 8 8 8 4 0 0 16 16 16 16 0 0 None
0x4a 24 dc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 2 1 Ncon
0x4b 24 dc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 2 1 Ncon
0x4c 24 dc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 4 1 Ncon
0x4d 24 dc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 4 1 Ncon
0x4e 24 dc 0 32 0 r . . 8 8 8 0 4 24 0 16 16 16 16 2 1 Ncon
0x4f 24 dc 0 32 0 r . . 8 8 8 8 4 24 0 16 16 16 16 2 1 Ncon
0x50 24 dc 0 32 0 r . . 8 8 8 0 4 24 0 16 16 16 16 4 1 Ncon
0x51 24 dc 0 32 0 r . . 8 8 8 8 4 24 0 16 16 16 16 4 1 Ncon
0x52 24 dc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 2 1 Ncon
0x53 24 dc 0 32 0 r y . 8 8 8 8 4 24 8 16 16 16 16 2 1 Ncon
0x54 24 dc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 4 1 Ncon
0x55 24 dc 0 32 0 r y . 8 8 8 8 4 24 8 16 16 16 16 4 1 Ncon
0x56 24 dc 0 32 0 r . . 8 8 8 0 4 24 8 16 16 16 16 2 1 Ncon
0x57 24 dc 0 32 0 r . . 8 8 8 8 4 24 8 16 16 16 16 2 1 Ncon
0x58 24 dc 0 32 0 r . . 8 8 8 0 4 24 8 16 16 16 16 4 1 Ncon
0x59 24 dc 0 32 0 r . . 8 8 8 8 4 24 8 16 16 16 16 4 1 Ncon
0x23 32 tc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 0 0 None
0x5a 32 tc 0 32 0 r y . 8 8 8 8 4 24 8 16 16 16 16 0 0 None
0x5b 32 tc 0 32 0 r . . 8 8 8 0 4 24 8 16 16 16 16 0 0 None
0x5c 32 tc 0 32 0 r . . 8 8 8 8 4 24 8 16 16 16 16 0 0 None
0x5d 32 tc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 0 0 None
0x5e 32 tc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 0 0 None
0x5f 32 tc 0 32 0 r . . 8 8 8 0 4 24 0 16 16 16 16 0 0 None
0x60 32 tc 0 32 0 r . . 8 8 8 8 4 24 0 16 16 16 16 0 0 None
0x61 32 tc 0 32 0 r y . 8 8 8 0 4 0 0 16 16 16 16 0 0 None
0x62 32 tc 0 32 0 r y . 8 8 8 8 4 0 0 16 16 16 16 0 0 None
0x63 32 tc 0 32 0 r . . 8 8 8 0 4 0 0 16 16 16 16 0 0 None
0x64 32 tc 0 32 0 r . . 8 8 8 8 4 0 0 16 16 16 16 0 0 None
0x65 32 tc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 2 1 Ncon
0x66 32 tc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 2 1 Ncon
0x67 32 tc 0 32 0 r y . 8 8 8 0 4 24 0 16 16 16 16 4 1 Ncon
0x68 32 tc 0 32 0 r y . 8 8 8 8 4 24 0 16 16 16 16 4 1 Ncon
0x69 32 tc 0 32 0 r . . 8 8 8 0 4 24 0 16 16 16 16 2 1 Ncon
0x6a 32 tc 0 32 0 r . . 8 8 8 8 4 24 0 16 16 16 16 2 1 Ncon
0x6b 32 tc 0 32 0 r . . 8 8 8 0 4 24 0 16 16 16 16 4 1 Ncon
0x6c 32 tc 0 32 0 r . . 8 8 8 8 4 24 0 16 16 16 16 4 1 Ncon
0x6d 32 tc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 2 1 Ncon
0x6e 32 tc 0 32 0 r y . 8 8 8 8 4 24 8 16 16 16 16 2 1 Ncon
0x6f 32 tc 0 32 0 r y . 8 8 8 0 4 24 8 16 16 16 16 4 1 Ncon
Emerald works okay, but I'd rather use the gtk decorator. Any help would be greatly appreciated.I don't want to be a bastard and all, and know that it's only been a few hours since I posted commenting that I have the same issue, but does anyone, absolutely anyone have any clue what is happening?
I have also tried running git compiz fusion and the issue is still there.
Also, when running emerald, the windecorations display fine but there are no shadows - at all.
When using gtk-window-decorator, the shadows exist but are of a similar color to my wallpaper and seem to glow and are definitely not shadowy... The decoration of the inactive window is completely transparent, save for the shadow and occasionally, parts of it render seemingly randomly looking garbled.
The issue is quite annoying since gtk-window-decorator is much faster than emerald and offers better integration with GNOME.
I'm using a GeForce 8600GTS with basically the same config files as the OP. I'm running 32-bit Arch.
I'm using the nvidia driver (as in current - I've installed the system today) and by checking nvidia.com, the version I have, 169.12 is the latest stable one.
So pretty please, with sugar on top, how do I get this working properly. This is the first time I've ever encountered the issue and so, could it be related to Arch configuration or to faulty packages?
Please help, anyone. It's quite frustrating and I really want fully-operational compiz.
Thanks everyone.
Sorry for double posting/shamelessly bumping. -
Hey, how's everybody doing?
Alright, basically I'm trying to draw a stickman baskeballer...he's going to bounce the basketball, until you click the mouse button (I'm going to use the d.awaitMousePress/Release method to do that). Problem is I'm useless at drawing...
I'm using simple shapes, like circles, rectangles and line etc.
Drawing window is 800 x 800 pixels and I have a brown rectangle for the floor, but that's about it lol. Any help?Hey,
First of all thanks for the replies. Sorry, yeah the question was too broad.
Ok basically I've drawn the image out already. It's the programming I need help with. The code I have so far is:
import element.*;
import java.awt.Color;
public class ogundimut_assign1
static DrawingWindow d;
public static void main(String args[])
d = new DrawingWindow(800,800); // declare object and variables
background();
baller();
ball();
public static void background()
// construct background
Rect floor = new Rect(0,600,800,150); // floor
d.setForeground(new Color(128,64,0));
d.fill(floor);
Rect backboard = new Rect(600,0,200,250); // backboard
d.setForeground(Color.black);
d.draw(backboard);
Line a = new Line(600,100,700,100); // shot square on backboard
Line b = new Line(700,100,700,200);
Line c = new Line(600,200,700,200);
d.setForeground(Color.red);
d.draw(a);
d.draw(b);
d.draw(c);
Rect post = new Rect(700,250,100,350); // post
d.setForeground(Color.lightGray);
d.fill(post);
Line e = new Line(550,200,600,200); // net
d.setForeground(Color.black);
d.draw(e);
Oval net = new Oval(480,190,70,20);
d.setForeground(Color.black);
d.draw(net);
public static void baller()
// construct basketball player
Circle head = new Circle(90,340,30); // head
Line body = new Line(90,370,90,500); // body
Line arm1 = new Line(90,420,170,420); // arms
Line arm2 = new Line(90,420,10,420);
Line leg1 = new Line(90,500,130,600); // legs
Line leg2 = new Line(90,500,50,600);
d.setForeground(Color.black);
d.fill(head);
d.draw(body);
d.draw(arm1);
d.draw(arm2);
d.draw(leg1);
d.draw(leg2);
public static void ball()
// construct ball
Circle ball = new Circle(160,440,20);
d.setForeground(Color.orange);
d.fill(ball);
I need to animate the image, using the elements package. My idea is to make the player bounce the ball until the mouse button is pressed, and then he'll take a shot. The problem I'm having is, I don't understand how I can animate it, without drawing the entire image again and then changing it slightly, then changing it slightly again, then again etc.
I'd like to just sort out the bouncing ball first. Only arm1 will be and the ball will be moving. Does anyone have any ideas?
Thanks -
Looking for Windows Decorations for Netbook
I'm struggling to find any window decorations that will fit nicely on my netbook screen. I'm running Xfce on a 1024x600 screen.
http://i.imgur.com/6aXuggM.png
Here's a screenshot of my setup so far, as you can see the window decorations are quite large, I'm looking for a minimalist and small set of window decorations, I'm open to any colours at the moment.
Does anyone have any suggestions?
Moderator edit [ewaller] Changed links to over size image to a url.
Last edited by ewaller (2014-04-19 15:34:25)I guess you already checked http://xfce-look.org/index.php?xcontentmode=420, there are few that are quite minimal. You could also try tweaking the xfwm themerc for any theme to make it more compact.
If you're feeling adventurous, you could switch to some tiling wm, and get rid of window decorations altogether. There are floating window managers with smaller decorations as well, for example openbox.
Also, most of GNOME applications are client side decorated and don't draw window borders at all, so switching to those could save you some screen estate too.
Sorry I didn't really answer your question, but I wanted to point out a few alternatives that may help your situation.
Btw, you shouldn't post full size images, but a thumbnail with link instead, or you'll make mods angry -
Hello,
A friend asked me this, and I couldn't come up with a reasonable answer on the spot.
Is there a way to keep two windows (JFrames, JWindows, whatever) in the same location relative to one another? As in, if I move Window A, Window B comes along for the ride. I think his end goal is to have a window that contains settings and whatnot slide out from underneath the other window, but stay behind it most of the time. Just a little bit of the "drawer window" would be visible hanging out from behind the main window.
My first thought was, maybe there's a Listener for window movement events, but I couldn't find one. Then I thought maybe overriding the windows' setLocation() methods to first call the OTHER window's setLocation().. but that would only work after the user was done dragging, not during.
Anybody have any ideas?This works for me. Updates as moving. Is that what you're looking for?
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
class Testing implements ComponentListener {
public void stub1(){
JFrame frame = new JFrame("Test");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.addComponentListener(this);
frame.setPreferredSize(new Dimension(800,400));
frame.pack();
frame.setVisible(true);
public void componentMoved(ComponentEvent e) {
System.out.println("Frame moved: "+e);
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new Testing().stub1();
public void componentHidden(ComponentEvent e) {}
public void componentResized(ComponentEvent e) {}
public void componentShown(ComponentEvent e) {}
} -
Lately my MBP has been momentarily lagging to the point where it stalls for more than 15 minutes and I have to force shutdown. The fans turn on as the MBP heats up. My only apps opened are iTunes, Firefox, Netnewswire and Mail at the time so I don't think its taking up most of my 4GB ram? Itunes is active playing songs.
I installed iStat Nano Dashboard a year ago and I decided today to check to see which app is taking up most of the processor upon this lag. I noticed it says "Window Server" is taking up 100% of my processing power. What is Window Server? I don't have my Parallels application on so I don't assume it means "Windows" as its "Window", so could it mean something related to Mac Os X?It's not due ot running Windows OS. It's always running on my Macs but at low levels--1 to 5 percent--and I have no virtualization set up. I googled "windowserver mac process" (note I left out the space) and found this "definition" in another forum:
The WindowServer does exactly what the name suggests: it acts as a server process to composite/draw windows onto the screen. It deals with taking the bitmap of each window and drawing it to the correct location on screen (as an OpenGL texture these days), layering the windows correctly and compositing them where there are translucent areas (again all done in OpenGL these days). It also handles the double buffering of windows backing stores allowing the updates to the window content to be smooth and flicker free.
(from http://forums.macrumors.com/showthread.php?t=300096)
One poster suggested it came from having Dashboard running, but the poster I quoted said it is not.
From what I can determine, your seeing high windowserver activity could be due to having too much stuff on your desktop. The system sees each icon as a potential new window and allocates resources to it. Too many desktop items have always slowed the Mac OS and, at some point upward of 250, can crash the system.
If your desktop have a lot of icons having about corral them into folders. If you have 100 items on the desktop and put them into six folders, the count dropped to six.
In case it is Dashboard, consider turning it off when not in use. It uses a lot of other background resources. I use the widget DashQuit to turn off Dashboard once I have the info I need. Remember, a lot of widgets have to remain active because the constantly "phone home" to update the info they display. They will eat cycles. -
An Illustrator window on each of two monitors
Hi. I'm working on two Illustrator drawings simultaneously, so I want an Illustrator window on each of my two monitors.
The only way I can find is to drag-resize the entire Illustrator window so that it fills both monitors, and then drag-resize each of the drawing windows to fit an individual monitor. There must be a tidier method than this?? Most programs treat 'internal' windows as separate entities that can be moved between monitors.
Tried dragging windows but they won't move outside the overall Illustrator window.
Tried opening a new instance of Illustrator - won't allow more than one Illustrator process even if started as a new task through Task Manager.
Can't see anything in menus, Help or forums.You don't mention your OS nor Illustrator version but in CS3 WinXP... that's the only way – AFAIK – to do it. Yes, it is a pain....
Cheers,
JJ -
Why cannot i get the window class ?
%cat test.R
x <- read.csv("000301.csv")
matplot(x[,1],x[,-1],type="l")
In R
> source("test.R")
The drawing windows is displayed but not floating in xmonad. So i want to get its window class using xprop
%xprop| grep -i class
When clicking the drawing window, xprop outputs nothing ! (BTW, The drawing window can be floated by using mouse+modKey)
Sincerely!Using xprop, i can get its wm_name
%xprop|grep -i wm_name
WM_NAME(STRING) = "R Graphics: Device 2 (ACTIVE)"
In myManageHook, i add the following line:
[name =? n --> doCenterFloat | n <- myNames]
name = stringProperty "WM_NAME"
myNames = ["bashrun","Google Chrome Options","R Graphics: Device 2 (ACTIVE)"]
But it doesnot work -
Hi, I'm new to the forums and really new to java and I was wondering if anyone could help me with a simple java program that I'm writing.
It deals simply with a bouncing ball (yes I know there's a topics on this one heh) that bounces aimlessly inside a drawing window.
Here's my problem:
I can make the ball bounce off two boundaries (top and right, left and bottom, right and bottom etc.) but when the ball reaches the 3rd boundary it just passes through it. It wont bounce off opposite sides (left and right, top and bottom) it only bounces off the first.
I believe it has something to do with my if statements under the move method.
I need to make some kind of loop so it keeps checking if the ball comes to a new boundary.
Right now it's only checking it once and after it bounces the ball one time thats it.
(I've tested all the boundaries to see if they bounce the ball and they all do, its just I can't bounce it more than 2 times)
I'm stuck on how to write this loop statement. Any help would be greatly appreciated! Thanks.
My code (If this isnt enough let me know please):
(BallTester.java)
import element.*;
public class BallTester{
public static void main(String[] args){
int width = 500;
int height = 400;
DrawingWindow d = new DrawingWindow(width,height);
Ball b = new Ball(70,30,width,height);
b.send(d);
(Ball.java)
import element.*;
public class Ball{
int base; // center line of where the circle starts
int size; // radius of circle
int xPos,yPos; // circle ctr
Circle c;
int width, height;
int dx,dy;
public Ball(int base, int size, int width, int height) {
this.base = base;
this.size = size;
c = new Circle(50,base,size);
this.width = width; this.height = height;
xPos = 50;
yPos = base;
public void drawOn(DrawingWindow d){
//draws the circle
c.drawOn(d);
public void clearOn(DrawingWindow d){
d.invertMode(); // black-> white
drawOn(d); //redraw in white: erase!
d.invertMode(); // white -> black
public void move(int dx, int dy){
//Sets boundaries for x values
if((xPos<=size)||(xPos>=width-size)){
dx = -dx;
else
xPos += dx;
//Sets boundaries for y values
if((yPos<=size)||(yPos>=height-size)){
dy = -dy;
else
yPos += dy;
c.move(dx,dy);
public void send(DrawingWindow d){
Waiting w = new Waiting();
//This below keeps the ball drawing up until j = width)
for(int j = 0; j < width; j++){
move(6,-3); // moves the circle based on dx, dy values
this.drawOn(d);
w.snooze(60);
this.clearOn(d);}You don't need a loop to check - you just need to check every loop (before you repaint).
I created an example for you. If this assignment is homework, don't hand it in - use it as a reference. Try to understand what's going on in the code and why it works.
import java.awt.*;
import javax.swing.*;
public class Test extends JFrame {
public Test () {
getContentPane ().setLayout (new BorderLayout ());
getContentPane ().add (new TestPanel ());
setDefaultCloseOperation (DISPOSE_ON_CLOSE);
setTitle ("Test");
pack ();
setLocationRelativeTo (null);
setVisible (true);
public static void main (String[] parameters) {
new Test ();
private class TestPanel extends JPanel {
private Ball ball;
public TestPanel () {
ball = new Ball ();
Thread painter = new Thread (new Runnable () {
public void run () {
while (true) {
try {
Thread.sleep (20);
} catch (InterruptedException exception) {}
repaint ();
painter.setDaemon (true);
painter.start ();
public Dimension getPreferredSize () {
return new Dimension (300, 200);
public void paintComponent (Graphics g) {
super.paintComponent (g);
ball.move (getWidth (), getHeight ());
ball.paint (g);
private class Ball {
private static final int W = 10;
private static final int H = 10;
private int x;
private int y;
private int dx;
private int dy;
public Ball () {
x = 0;
y = 0;
dx = 2;
dy = 2;
public void move (int width, int height) {
int x = this.x + dx;
int y = this.y + dy;
if ((x < 0) || (x + W > width)) {
dx = -dx;
x = this.x + dx;
if ((y < 0) || (y + H > height)) {
dy = -dy;
y = this.y + dy;
this.x = x;
this.y = y;
public void paint (Graphics g) {
g.fillOval (x, y, W, H);
} -
Help with my Bouncing ball?
Hey guys,
I really have the basis of my program working and everything however i just had one question. My Animation works by using the Alarm which uses the take notice method. The takeNotice then calls a move method that updates my ball coordinates. I am having trouble slowing down the animation. My question is how could I slow down the animation for the viewer without altering the velocity. My set period is at 25 milliseconds that makes the ball animation very smooth however when I increase the milliseconds the animation becomes sloppy and choppy. Does anyone have any ideas of how I could fix this problem???
Thanks guys
The BingBong class which sets up my environment...
BingBong.java
This class defines and implements the demo itself.
It also implements all the methods required to implement a "MouseListener".
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
public class BingBong extends Frame
implements MouseListener, AlarmListener
// The instance variables
private Abutton resetButton, // My Buttons
throwButton,
slowButton,
fastButton;
private WindowClose myWindow = // A handle on the window
new WindowClose();
private int lastX, lastY; // To keep the mouse location
private Alarm alarm; // We use an alarm to wake us up
private Ball ball; // Creating my one ball
// Constructor
// ===========
// The constructor defines a new frame to accommodate the drawing window.
// It also sets the scene with the visualization of the element
// and the buttons to manipulate the value of the element.
public BingBong()
setTitle("Bing Bong"); // We set the characteristics of our
setLocation(50, 50); // drawing window
setSize(420, 450);
setBackground(Color.pink);
setVisible(true);
addWindowListener(myWindow); // To check on the window
addMouseListener(this); // and on the mouse
int x = 53; // Setting the start points for the button coordiates
int y = 25;
resetButton = new Abutton("Reset", Color.red, x, y);
x += Abutton.BUTTON_WIDTH + 5;
throwButton = new Abutton("Throw", Color.gray, x, y);
x += Abutton.BUTTON_WIDTH + 5;
slowButton = new Abutton("Slower", Color.yellow, x, y);
x += Abutton.BUTTON_WIDTH + 5;
fastButton = new Abutton("Faster", Color.green, x, y);
alarm = new Alarm("Beep", this); // We "create" an alarm
alarm.start(); // and we get it started
alarm.setPeriod(25); // The alarm will go off every 35 milliseconds
public void action()
System.out.println("\nClick on one of the buttons!\n");
repaint(); // When the program is launched we will notify the user to click via the console
// The next method checks where the mouse is been clicked.
// Each button is associated with its own action.
private void check()
if (resetButton.isInside(lastX, lastY)) {
ball = null; // If the reset button is hit the ball will go away
else if (throwButton.isInside(lastX, lastY)) {
double randomX = 380*Math.random(); // Creating a random starting spot for the ball
double randomY = 420*Math.random();
double randomSpeedX = (9*Math.random()) + 1; //Giving the ball a random speed
double randomSpeedY = (7*Math.random()) + 1; // By adding at the end I protect
// in case the random creates a zero
ball = new Ball(randomX, randomY, -randomSpeedX, -randomSpeedY);
// Calling the Ball constuctor to create a new ball
else if (slowButton.isInside(lastX, lastY)) {
double currentSpeedX = ball.getSpeedX(); // Getting the current ball's speed
double currentSpeedY = ball.getSpeedY();
double newSpeedX = currentSpeedX - (currentSpeedX/4); // Taking 1/4 of the current speed and
double newSpeedY = currentSpeedY - (currentSpeedY/4); // and subtracting it from the current speed
ball.setSpeed(newSpeedX, newSpeedY); // Calling the set speed method
else if (fastButton.isInside(lastX, lastY)) {
double currentSpeedX = ball.getSpeedX(); // Getting the current ball's speed
double currentSpeedY = ball.getSpeedY();
double newSpeedX = (currentSpeedX/4) + currentSpeedX; // Taking 1/4 of the current speed and
double newSpeedY = (currentSpeedY/4) + currentSpeedY; // and adding it to the current speed
ball.setSpeed(newSpeedX, newSpeedY); // Calling the set speed method
else {
System.out.println("What?"); // I did not understand the action
repaint();
// In order to use an alarm, we need to provide a takeNotice method.
// It will be invoked each time the alarm goes off.
public void takeNotice()
if (ball != null){ // If the ball exists everytime the alarm goes off move the ball
ball.move();
repaint(); // Finally, we force a redrawing
// The only "graphical" method of the class is the paint method.
public void paint(Graphics pane)
if (throwButton != null) // When instantiated,
throwButton.paint(pane); // we display all the buttons
if (slowButton != null)
slowButton.paint(pane);
if (fastButton != null)
fastButton.paint(pane);
if (resetButton != null)
resetButton.paint(pane);
if (ball != null) // Drawing the ball
ball.paint(pane);
pane.drawLine(10, 60, 10, 440); // Using pixel coord. to draw the lines of our "box"
pane.drawLine(10, 440, 410, 440);
pane.drawLine(410, 440, 410, 60);
pane.drawLine(10, 60, 70, 60);
pane.drawLine(410, 60, 350, 60);
public void mouseClicked(MouseEvent event)
check(); // Handle the mouse click
public void mousePressed(MouseEvent event)
lastX = event.getX(); // Update the mouse location
lastY = event.getY();
flipWhenInside(); // Flip any button hit by the mouse
public void mouseReleased(MouseEvent event)
flipWhenInside();
public void mouseEntered(MouseEvent event) {}
public void mouseExited(MouseEvent event) {}
private void flipWhenInside()
if (resetButton.isInside(lastX, lastY)) // Flips the buttons to emulate
resetButton.flip(); // a push down effect when clicked.
else if (throwButton.isInside(lastX, lastY))
throwButton.flip();
else if (slowButton.isInside(lastX, lastY))
slowButton.flip();
else if (fastButton.isInside(lastX, lastY))
fastButton.flip();
repaint();
} // end BingBongMy Ball Class holds its own unique characteristics.....
Ball.java
Programmer: Jason Martins
7/2/08
import java.awt.*;
import java.awt.event.*;
public class Ball
// My private variables:
private double x = 0; // The location of the ball.
private double y = 0;
private Color color = Color.BLUE;
private double speedX, speedY; // The speed of my ball.
private double gravity = 0.098; // The gravity effect (9.8 m per s).
private double bounceFactor = 0.97; // The bouncy ness of my ball.
private final
double
DIAMETER = 21, // The size of my ball.
LEFT_SIDE = 10,
RIGHT_SIDE = 410,
BOTTOM_BOX = 440;
// The default constructor for the Ball.
public Ball(){
// The Ball constructor will create an
// ball due its own unique x and y coordinate as well as its speed.
public Ball(double x, double y, double speedX, double speedY){
this.x = x; // When a new ball is created,
this.y = y; // it will have 4 critical
this.speedX = speedX; // doubles. The x and y coordinate and its speed
this.speedY = speedY; // horizontally and vertically.
// Drawing a ball
public void paint(Graphics pane)
pane.fillOval((int) x, (int)y, (int) DIAMETER, (int) DIAMETER);
// The fillOval method will start from the specfied x and y and draw a oval based on size and height.
// Will set the color of the given ball, by the specific color passed.
public void setColor(Color color){
this.color = color; // Sets the color of the ball.
// Returns the x coordinate the ball is current at.
public double getX(){
return x;
// Returns the y coordinate the ball is current at.
public double getY(){
return y;
// Returns the horizontal velocity of the ball.
public double getSpeedX(){
return speedX;
// Returns the vertical velocity of the ball.
public double getSpeedY(){
return speedY;
// Sets the speed of the ball by the horizontal and vertical velocity passed.
public void setSpeed(double newSpeedX, double newSpeedY){
speedX = newSpeedX;
speedY = newSpeedY;
// Will move the ball inside the frame depending on numerous factors.
public void move(){
x += speedX; // Add horizontal speed to the x location and update the location.
y += speedY; // Add vertical speed to the y location and update the location.
speedY += gravity; // Add gravity to the vertical speed and update the vertical speed.
if(x <= LEFT_SIDE){ // If my x coordinate is equal to the boundry on the left.
x = LEFT_SIDE; // The ball bounces reversing the horizontal velocity.
speedX = -speedX;
if(x + DIAMETER >= RIGHT_SIDE){ // If my x coordinate is equal to the boundry on the right.
x = RIGHT_SIDE - DIAMETER; // The ball bounces reversing the horizontal velocity.
speedX = -speedX;
/*if(y <= 60 && x <= 70){
y = 60;
x = 70;
speedY = -speedY;
if(y <= 60 && x >= 350){
y = 60;
x = 350 - DIAMETER;
speedY = -speedY;
if(y + DIAMETER >= BOTTOM_BOX){ // If my y coordinate is equal to the boundry on the bottom.
y = BOTTOM_BOX - DIAMETER; // The ball bounces reversing the vertical velocity times
speedY = -speedY * bounceFactor; // the bouncyness of the ball.
}My Alarm Class.... given to us by our professor
Alarm.java
A l a r m
=========
This class defines a basic timer, which "beeps" after a resetable delay.
On each "beep," the alarm will notify the object registered when the timer
is instantiated..
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet;
public class Alarm
extends Thread
private AlarmListener whoWantsToKnow; // The object to notify
// in case of emergency
private int delay = 0; // The first beep will occur
// without any delay
// C o n s t r u c t o r s
public Alarm()
super("Alarm"); // With the default constructor,
whoWantsToKnow = null; // nobody will be notified
public Alarm(AlarmListener someBody)
super("Alarm"); // In general, we expect to know who
whoWantsToKnow = someBody; // (i.e., which object) to notify
public Alarm(String name, AlarmListener someBody)
super(name); // We can also give a name to the alarm
whoWantsToKnow = someBody;
// The setPeriod method will set or reset the period by which beeps will occur.
// Note that the new period will be used after reception of the following beep.
public void setPeriod(int someDelay)
{ // Note: The period should be expressed
delay = someDelay; // in milliseconds
// The setPeriodicBeep method will keep on notifying the "object in charge"
// at set time intervals.
// Note that the time interval can be changed at any time through setPeriod.
private void setPeriodicBeep(int someDelay)
delay = someDelay;
try {
while (true){ // For as long as we have energy,
Thread.sleep(delay); // first we wait
if (whoWantsToKnow != null) // then we notify the
whoWantsToKnow.takeNotice();// responsible party
} // (if anybody wants to hear)
catch(InterruptedException e) {
System.err.println("Oh, oh ... " + e.getMessage());
// The alarm is a Thread, and the run method gets the thread started, and running.
public void run()
System.out.println("The alarm is now running.");
setPeriodicBeep(delay);
} // end of class AlarmThanks guys againOne slightly confusing thing is that what you are calling speedX and speedY are not, in fact, the speed of your ball in the X and Y directions. They are the location-change-in-pixels-per-frame values.
The "best" refresh rate has more to do with
(1) the responsiveness of your application: how often it can redraw the screen. This sets an upper limit on the refresh rate. If you try a refresh rate that is too high (ie a delay that is too small) your application won't be able to keep up.
(2) how sensitive the user is to detecting "jerkiness". This sets a lower limit on the refresh rate. If you try a refresh rate that is too low (a delay value that is too big) then the user will at some point complain that the animation is "choppy".
It's a matter of trial and error, but I would start at 20 frames per decond (delay == 50) and see what happens. (The code I posted did that - I haven't run it.) If it appears choppy you can print the time inside your paint() method. This will let you check that you really are repainting every 50ms. If not, then you have exceeded the limit mentioned in (1). That is, your application can't "keep up" and you will need to improve the effeciency of paint().
Say my velocity was 5, if i set my period too 1000 * 5 / (my preferred delay say 50) == 100I'm not completely sure I understand this - if your delay is 50, then the refresh rate must be 1000/50=20 frames per second. You can't change that. If you wanted the ball to move at 5 pixels per second (in the X direction) and your delay was 50 (ie 20fps) then you would find the appropriate speedX value by solving the equation:
5 = 1000 * speedX / 50
speedX = 0.25(Note: 5 pixels per second is not very fast)
Maybe you are looking for
-
I have a Denon 1913 AVR and Apple TV. Doesn't work...
The Denon won't pass through the video to the TV. I connected the HDMI directly to the TV and the optical out to the Denon, but the audio won't come through (apparently optical audio can only come from the TV). Any suggestions?
-
HT204350 Migration Assistant is NOT working
Migration Assistant is NOT working - Have tried from from a hard disk and using the Thunderbolt cable. Keeps Looking for Source. Any ideas? I really want to more on to my new Mac.
-
BSP Session times out in Portal iView
HI, I have a stateful BSP Application with two pages. First BSP Page navigates via a POST to third party site from which, the request returns back to the original BSP to the second page. I pass the url of the application, along with the session infor
-
Idocs getting posted as segments
Hi all, I have a scenario where in there are mutilpe idocs in a message (XI output) but when its getting posted to SAP(r/3) its posting as multiple segments in one idoc instead of multiple idocs. I would be glad if someone help me in resolving this.
-
Blade 1000 won't power on all the way
The tab for the interlock switch was broken and I fixed that with some duct tape, but now the blade 1000 will not power on all the way - does not even get to an OK prompt. When I push the power button the fans come on and the drive starts to spin, th