473,804 Members | 2,985 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

change frame to script

3 New Member
Hi.
I have a program which changes a frame`s background on mouseover.
The problem is that I need several panels to change color on mouseover.....
If somebody could help.,...
Here is the code:

Expand|Select|Wrap|Line Numbers
  1. import java.awt.Color;
  2. import java.awt.event.MouseAdapter;
  3. import java.awt.event.MouseEvent;
  4. import javax.swing.JFrame;
  5.  
  6. /**
  7.  */
  8. public class MainFrame extends JFrame{
  9.  
  10.     /** Creates a new instance of MainFrame */
  11.     public MainFrame()
  12.     {
  13.         // add mouse listener
  14.         addMouseListener(new MouseAdapter() {
  15.  
  16.             // invoked when mouse enters the form
  17.             public void mouseEntered(MouseEvent e)
  18.             {
  19.                 // generate random color
  20.                 Color c = new Color((float)Math.random(), (float)Math.random(), 
  21.                         (float)Math.random());
  22.  
  23.                 // set background
  24.                 getContentPane().setBackground(c);
  25.             }
  26.         });
  27.     }
  28.  
  29.     /**
  30.      * @param args the command line arguments
  31.      */
  32.     public static void main(String args[]) {
  33.         java.awt.EventQueue.invokeLater(new Runnable() {
  34.             public void run()
  35.             {
  36.                 new MainFrame().setVisible(true);
  37.             }
  38.         });
  39.     }    
  40. }
  41.  
Dec 8 '06 #1
1 1530
DeMan
1,806 Top Contributor
Have you got a handle for the panels? If so, you should be able to use much the same method
Dec 9 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5310
by: RWD | last post by:
I am trying to figure out how to change the target frame in my hyperlink on a DHTML menu. The menu is in one frame and the target frame is called "main" The code is below: Thanks in advance RWD <script type='text/javascript'>
1
2377
by: Knud | last post by:
I have a frameset where a hidden frame reloads every 5 seconds and collects data from the sever if there are any changes made in a database. The hidden page updates Div fields on other frames with the lastest information. This works great. The problem I have is that when the hidden frame reloads it steals focus from the main frame where a user can be entering information into a form. (This is very annoying. As tabing through form...
3
7076
by: Robert | last post by:
Hi, I'm trying to make a slide show, with two frames: on the left frame small thumbnails, and on the right frame the big sized image. Of course when the user clicks on a thumbnail in the left frame, this image should be shown in the right frame. As I have a large number of pictures I don't want to have a separate page for each picture, and use javascript instead. I would like to use this in the left frame (see full code below):
5
3513
by: Martin Chen | last post by:
I have a frame set (as per MS FrontPage 2000). It has a contents and a main frame. The contents frame has a menu bar written with with javascript (in the context of a table). In IE6.1 everything works fine as it also does in firefox if I call the contents frame directly (i.e. outside of its frameset). However, if I call my main page (index.html) which invokes the frame set, the contents frame javascript menubar onmouseover function...
3
10205
by: Vongza | last post by:
<html> <head> <title>Cross Frame Reference</title> <script language="javascript"> function showThisTitle() { alert(document.title); } function showAnotherTitle() { try { alert(anotherWorld.document.title);
11
16964
by: Rob | last post by:
I know, I know, don't use frames. Well, I'm stuck with these frames and I'm trying to add functionality without a complete redsign. You can look at this as a nostalgic journey. Anyway, I've got the following frame structure at the top level: FRAMESET CODE <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"> <html><head><title>Server List</title></head> <frameset frameborder="1" border="1" framespacing="1" rows="10%,89%">
42
3891
by: smerf | last post by:
Using javascript, is there a way to trap an external page inside a frame? I've seen scripts to break out of frames, but nothing to keep a page trapped in a frame.
2
2780
by: hugoatkol | last post by:
How to Resize a frameset without an id eg. <frameset rows="85,*" framespacing="0" border="0" frameborder="NO"> <frame src="url1" name="dot_tk_frame_top" noresize scrolling="NO"> <frame src="url2" scrolling="auto" noresize> </frameset> sow thw rows change to eg. 75,* instead of 85,*
7
3003
by: Leoa | last post by:
Hi All, I'm having a hard time figuring out the DOM syntax to get one frame that has thumnails of images to display at full size in another frame (onmouseover). I looked at a couple tutorials and have come up with the broken script below. Please Help.- ------------------------------------------
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9577
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10569
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10325
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10315
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9140
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7615
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
4295
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.