Swing/AWT/SWT :: Notification Window Minimized As The Messenger

Feb 17, 2014

I need that when my application is minimized notify you when something happens, like the messenger (MSN) remember? The window notifying a new message, the minimized window blink in orange, orange need not be ok? I do not even know where to start.

View Replies


ADVERTISEMENT

Swing/AWT/SWT :: JTable Cell Renderer Causing Program To Go Black When Minimized

Aug 25, 2014

I'm making a program that selects classes from a database via a jcombo box and then populates a time table with the class times.

I've used a custom cellrenderer that extends DefaultTableCellRenderer to text wrap the information and change the background of the cells.

It works but when i minimize the program it goes all black and if I double click I get a new JTextArea opening up on the timetable and when I minimize the program and go to open it again i get an "Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException" and the cell render seems to be called again even though i haven't rerun the program.

This is the cell renderer that I built

public class TimesTableCellRenderer extends DefaultTableCellRenderer {
private int minHeight = -1;
private final JLabel label = new JLabel();
private final JTextArea textArea = new JTextArea();
public TimesTableCellRenderer(){
super();
textArea.setLineWrap(true);

[Code] ....

View Replies View Related

Swing/AWT/SWT :: How Can Two Different Objects Receive Notification Of Same Event

Feb 23, 2015

The scenario:

* A pop-up menu generates an array of rectangle objects; each rectangle having random x.y coords and colour.
* The number of rectangles in the array is user selected from the popup list.
* The APopUp class has a 'getter' method that returns the array.
* The pop-up object is instantiated in an object of the AFrame class.
* The AFrame object needs to get the array each time the popup changes its state.

The problem:
.
* As I see it, the AFrame object needs to informed of the pop-up's state of change event or does the problem lie in how I have decided
which responsibilities each class is to have? I've tried to be as logical as possible during planning.

In the days of FORTRAN or BASIC we would hammer a solution through with brute force, but I would like to keep to Java's philosophy
of encapsulation and clean interfaces and that it seems to has generated a impasse of brain warping proportions.

import java.awt.Frame;
import java.awt.Label;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
public class AFrame extends Frame implements ItemListener {

[code]....

View Replies View Related

Show System Tray Or Desktop Notification From Web Application Based On Java

Nov 23, 2014

The explanation is a bit lengthy because I just tried to explain everything in one shot.

Link to the question

java - Show a System Tray notification or Desktop notification from the web application

View Replies View Related

Swing/AWT/SWT :: Simplest Window Possible

Feb 5, 2014

Is it possible to display an AWT Window only(just 'cause feel like doing it)? Or, is the simplest window possible to display a JFrame?

View Replies View Related

Swing/AWT/SWT :: Displaying PNG In A Window

Jan 31, 2014

That's my third day working in Java using Swing and the IntelliJ Idea IDE.I'm trying to do something as simple as displaying a PNG in a window, and I'm doing this:

public class AboutRapide {
public JPanel mainPanel;
private void createUIComponents() {
mainPanel = new ImagePanel();

[cod]....

the problem is that, in the paintComponent method, the Image is never found when I run my app from the IDE, but it is when I run it from Finder in my Mac. Same application. I think it relates to how the application is launched so I guess what's a proper way to refer to a resource file with an image so it can be displayed no matter how the application is launched?Also if I generate a Jar for the application, as the resource gets into the Jar compressed file, it can't also be loaded.

View Replies View Related

Swing/AWT/SWT :: Creating Circular Window?

Aug 20, 2014

I want to develop an application, which shows a circular window with close, maximize buttons.

I want to create something like this: [URL]

View Replies View Related

Method To Wait On Different Swing Window?

Dec 20, 2014

I am trying to create a gambling POS system and having problems with a method trying to get a value right after it was set. A jbutton sets another jframe visible which contains buttons. Upon action of the button, a value is set and the jframe is disposed.

private void btnPrizeActionPerformed(java.awt.event.ActionEvent evt) {
PrizeSelling prize = new PrizeSelling();
prize.setVisible(true);//create prize selection window
bin = getButton(); //gets what button is selected to load the correct prizes for correct game
prize.DBconnect(bin);//sends bin number to prize loading method

[Code] ....

As soon as btnPrize is clicked it gets the total value of the prizes selected which of course is 0 because it is ran before it is set. How can I make it wait until the window is closed before continuing?

View Replies View Related

Swing/AWT/SWT :: Dragging Window Downwards - Screen Alignment?

Oct 29, 2014

I am trying to drag the window down wards and screen has alignment issues. I tried to use WindowListeners, Component Listeners, MouseListeners ect…

But still this problem persists as only I release the mouse after drag down it appears fine that we have handled ComponentResized() method. So how to restrict component size while keep dragging down?

View Replies View Related

Swing/AWT/SWT :: Child Window Doesn't Open

Mar 23, 2014

sale s = new sale();
jDesktopPane1.add(s);
s.show();

says not a suitable method?

View Replies View Related

Swing/AWT/SWT :: JButton Opening New JFrame In New Window

Oct 14, 2014

We are creating a quiz as a school program, we are using netbeans and we have a little problem. The problem is that our JButton opens a new JFrame in a new window and we want it to stay in the same window. The code we are using is:

private void PlayButtonActionPerformed(java.awt.event.ActionEve nt evt) {
Question1 s = new Question1 ();
s.setVisible(true);
}

Is it possible to make it stay in the same window?

View Replies View Related

Swing/AWT/SWT :: Creating New Window Or Call Existing One

Oct 13, 2014

Will the code below just create a new blank window rather than call the one I have? I want to call the one I have from my main method ideally.

JMenuItem menuDelete = new JMenuItem("Delete");
menuDelete.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
DeleteEnvironmentWindow deleteEnv = new DeleteEnvironmentWindow();
deleteEnv.setVisible(true);
}

View Replies View Related

Swing/AWT/SWT :: WindowListener Not Being Called When Clicking X To Close Window

Oct 14, 2014

I have added a windowListener to my JFrame but for some reason it is not being called when I click X to close the window. I need to send a message to a server to notify it that the client window is closed. Some code snippets below (some lines excluded for brevity):

public class ChatGUI extends javax.swing.JFrame {
....
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE); // I have all the window constants here but has no effect other than closing the window without calling the listener...
addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosed(java.awt.event.WindowEvent evt) {
formWindowClosed(evt);
}
});
....
private void formWindowClosed(java.awt.event.WindowEvent evt) {

[code]....

This is resolved, needed to use...

addWindowListener(new java.awt.event.WindowAdapter() {
public void windowClosing(java.awt.event.WindowEvent evt) {
formWindowClosing(evt);
}
});

... instead.

View Replies View Related

Swing/AWT/SWT :: Getting Icons To Change Size With Window Resize

Jan 19, 2014

I'm using a jpanel with an 8 by 8 grid layout of jlabels to which I'm adding images to represent a chess board. At first, I was using the ImageIcon class to initialize my icons, but as soon as I added these icons to the labels, the labels no longer changed size with the window (which I want to happen). URL...

So I copied in the class, and initialized a different set of icons using the stretch icon class (specifically, the method that allows you to initialize a stretch icon from a filename), however, when I use these stretch icons, the result is the same. Is something wrong with the class, or with my implimentation of it, and how would I fix this?

View Replies View Related

Swing/AWT/SWT :: Getting Icons To Change Size With Window Resize?

Jan 16, 2014

I'm using a jpanel with an 8 by 8 grid layout of jlabels to which I'm adding images to represent a chess board. At first, I was using the ImageIcon class to initialize my icons, but as soon as I added these icons to the labels, the labels no longer changed size with the window (which I want to happen). Someone suggested to me to use this custom stretch icon class, found here:

[URL] ....

So I copied in the class, and initialized a different set of icons using the stretch icon class (specifically, the method that allows you to initialize a stretch icon from a filename), however, when I use these stretch icons, the result is the same. Is something wrong with the class, or with my implementation of it, and how would I fix this?

View Replies View Related

Swing/AWT/SWT :: Jscrollpane Not Shown Until Adjust Window Size With Mouse?

Nov 16, 2014

So for a test i have a small array set as a jlist which is the contents of my jscrollpane, and it appears as if nothing is there until i adjust the window size by dragging it out or in... whats going on?

Here is the full code

import java.awt.BorderLayout;
import java.awt.ComponentOrientation;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;

[Code] ...

View Replies View Related

Swing/AWT/SWT :: Getting Jlabel Icons To Change Size With Window Resize?

Feb 20, 2014

I'm trying to create a chess program in java swing, and for the board I'm using an 8 by 8 array of jlabels stuck inside a jpanel with a grid layout. I would like the board to change size when the window changes size, and the grid layout accomplishes this succesfully, until I add the actual icons to the jlabels. Then the board just stays a fixed size. Someone suggested I use their "Stretch Icon" class, found here:[URL] ...., so I tried initializing the icons using one of the constructors in the class (the one that takes an image name and a boolean value for whether or not you want the resisizing to be proportionate (to maintain the aspect ratio)). However, the same thing happened. The board appears, but it does not resisize. To attempt to fix this problem, I tried simplifying my code, reducing the program to two jlabels within the jpanel, for which I then tried to set the image in the same way. Here is my simplified code:

import java.awt.*;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.ImageIcon;

[Code] ....

I'm misusing the stretch icon class, or just generally what's going wrong/how to fix it?

View Replies View Related

Swing/AWT/SWT :: How To Return Values From A JForm To The Main Window On Close

Jan 26, 2014

I am making a java swing program. I have a main window that opens a JForm window when the user clicks a menu option. Then I have a button on the JForm that closes the window on click. However, I would also somehow like to make the JForm return values to the main window (according to the states of the selector components) when it is closed. How would I go about this? Currently my jForm is a seperate class called "NewGame", and inside the menu item mouse clicked method, I have the following code:

//open new game jform window
NewGame newGameWindow = new NewGame();
newGameWindow.setVisible(true);
newGameWindow.setLocationRelativeTo(null); //center window

Is there something I can add here to get the object's values upon the window's close? Or is there a way I can add that into the button clicked method on the actual jForm?

View Replies View Related

Swing - WindowStateChanged Event Updates Window Size After It Completes

Feb 12, 2014

I have a JFrame where some elements (one, for now) have to be centered manually on the contentPane when resizing the window or changing the window state. Resizing event (componentResized) works fine but the windowStateChanged event is causing problems because it doesn't seem to "update" the contentPane's new size properly - it keeps the previous value although the window's size is obviously changed. This can be seen by simply printing the result of getSize called on contentPane.

Centering is done by programmatically changing the constraint of the component (using putConstraint, SpringLayout). The issue is that getWidth used in that method returns "wrong" values which results in an uncentered component. Maybe another listener is needed here?

Additional info: Eclipse with WindowBuilder, Linux Mint 15, Java 1.7

I know about SSCCE guidelines but I cannot make this particular example both ready to compile and short.For unknown reasons, I am unable to post the code example. I keep getting this - "Post denied. New posts are limited by number of URLs it may contain and checked if it doesn't contain forbidden words."

addWindowStateListener(new WindowStateListener()
{
// no "@Override" was generated but it is the same with it
public void windowStateChanged(WindowEvent e)
{
System.out.println("EVENT: " + contentPane.getSize() + ", "
+ getExtendedState() + ", " + e.getOldState()); // amusingly, states are actually correct - interchanging between 0 (Frame.NORMAL) and 6 (Frame.MAXIMIZED_BOTH) when I maximize and "unmaximize"
tfArrayPanelCenter();

[code]....

View Replies View Related

JavaFX 2.0 :: Manipulating Several Windows (Window Inside Window)

Apr 6, 2015

I am new to javafx I start using it instead of swing i used the scene builder for my forms the problem i faced i don't know how to have main screen with menu bar at top and depending the select from the menu it will open other windows and those window must be inside my window just like for example netbeans.

I don't need to open new window in separate i need all windows inside my main window and controlling over them minimize maximize perhaps.

View Replies View Related

Swing/AWT/SWT :: Window To Submit Data Freezing When Created Inside Mouse Clicked Event

Feb 18, 2014

I'm trying to right a GUI in swing, and as part of my program, I want to open a secondary window out of the main window when a mouse clicks on the main window. Then, once I click a button on the secondary window, I want that window to close and submit data to the main window (like an info form). I have almost figured out how to do this, except for one problem. By putting a variable inside my form window called "ready," and then in my main window running a loop that constantly checks if ready is true and doesn't proceed until its true, I can create the form window, modify the values in it (currently just one value called "difficulty" that's modified by a jSlider), and then when i click the "begin" button, ready is changed to true, the form window closes, and the main window can proceed. However, when I try to put the while loop checking the ready variable inside a mouseClicked method in the main window, the form window freezes when it opens, and you can't see any of its content or modify it in any way (you can't even close it).

Here is my code:

//form window class
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
public class formWindow extends JFrame {
private JTextField instructions1;

[Code]...

View Replies View Related

How To Specify Location Of Opened Window

May 8, 2014

I am writing a small app to automate some actions on my computer this requires me to open an application and click on a button I am using

Process child0 = Runtime.getRuntime().exec("/home/user/application");

to do this. The problem is every time it opens at a different lcation on the screen so i cannot click on it using the robot class due to x,y coordinates being different every time. with selenium you can use .setlocation(x,y) method but how can this be done for other applications.

View Replies View Related

Can't Create A 100x100px Window

Apr 19, 2015

I have an assignment to create a circle with a radius of 40px in a 100px by 100px window and move the circle with the arrow keys.The circle can't move past the the edges of the window. I believe I have the code right but the window won't create the window or pane with a width of 100 px because of the close, minimize, maximize buttons. Is there a way to remove those or force JavaFX to create it with a width of 100px? Here's what I've got so far.

package movecircle;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.stage.Stage;

[code]....

View Replies View Related

Making Window Not Resizable

Oct 9, 2014

How would i go about making this NOT resizable?

If I do try to do ChatFrame.setResizable(false); it gives me this error:

Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problem:
Cannot make a static reference to the non-static method setResizable(boolean) from the type Frame

at com.ui.ChatFrame.<init>(ChatFrame.java:37)
at com.ui.ChatFrame$5.run(ChatFrame.java:403)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)

[Code] ....

Here is the code:

package com.ui;
import com.socket.History;
import com.socket.Message;
import com.socket.SocketClient;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;

[Code] ....

View Replies View Related

Window Closing Event

May 20, 2014

I have a WindowClosing(WindowEvent e) method, but when I close my window it isn't doing anything inside the method. I am making a launcher and I want to make it so when the actual game window is closed it makes the launcher window visible again.

Java Code: public void windowClosing(WindowEvent e) {
this.jf.setVisible(true);
} mh_sh_highlight_all('java');

View Replies View Related

Repaint Window From Another Class?

Mar 31, 2014

I am trying to repaint a window from another class. the class Window handles an interface that displays pictures of movies. Via a JMenuBar you can add a new movie and its picture but in order for it to show in the Window i need to repaint certain aspects in the Window class GUI;

The window class constructor:

public Window() {
addComponents();
configurFrame();
addMenu();
}

The functions i want to repaint:

public void repaintWindow() {
this.getContentPane().validate();
this.getContentPane().repaint();
}

From my other class where i add a movie to an ArrayList i have made a "private Window myWindow;" there i call the function repaintWindow via mywindow.repaintWindow(); But this gives me an NullPointerException related to the repaintWindow function.

View Replies View Related







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