Cerberus 17 Junior Poster
JFrame f = new JFrame();

//disable the close button
f.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

//create custom close operation
f.addWindowListener(new WindowAdapter()
{
      public void windowClosing(WindowEvent e)
      {
          exitProcedure();
      }
});

in the exitProcedure method i just use an if else ladder to work out if i need to save or exit etc.

leiger commented: Thanks! I needed this solution and this was the only place I found it! +0
Cerberus 17 Junior Poster

Problem solved.

Cerberus 17 Junior Poster

Ok thanks it's working.

But i've got another problem.

When the user tries to close the application it asks if they want to save their changes (if they have made any). They can select ok (to save) no (to exit) and cancel.

The problem is that i want cancel to allow them to continue using the application, however it continues to exit.

Is there anyway that i can override the exit operation?

Thanks.

Cerberus 17 Junior Poster

Sorry if this has been asked before.

I have a jframe with a textcomponent in it and a menu with an exit option. When you select the exit option a funciton is called that checks whether a change has been made to the document and the user can select to quit anyway or save changes etc.

What i need is to call the same function when the close button in the top right of the jframe is selected.

Any help would be appreciated, thanks.

Cerberus 17 Junior Poster

Hi, i have a page which is built from an asp script providing a thumbnail of an image from a database. I want to enlarge the image (when clicked on) in a new window and i can't work out how to do it using Javascript.

Any help would be much appreciated.


Also can you include two external CSS files in the same html page?

Cerberus 17 Junior Poster
#include <iostream.h>
#include <stdlib.h>

void printNumbers();

const NUMBERS = 10;

void main()
{
    printNumbers();
    system("pause");
}

void printNumbers()
{
   int numberArray[NUMBERS];

    for(int i = 0; i < NUMBERS; i++)
   {
       numberArray[i] = i;
   }

   for(int i = 0; i < NUMBERS; i++)
   {
       cout << (numberArray[i] + 1) << endl;
   }
}
Cerberus 17 Junior Poster

Hi i have a piece of code that checks to see if an indexed point in a string is white space....

if(Character.isWhitespace(c.charAt(0)))
{
return true
}

and i want to use the same technique to return true if an open chevron '<' is at a point in the document but i'm not sure how. It must be a similar method and the chevron unicode but i'm stuck.


Can anyone help?

Cerberus 17 Junior Poster

I've made a decision to develop using Java.

Any advice would be very helpful.

Cerberus 17 Junior Poster

Sorry i don't think i was clear.

I meant that i was creating an editor and i wanted to implement highlighting as a feature.

Cerberus 17 Junior Poster

Can anyone point me in the right direction to how you can add highlighing to a source code text editor.

I don't know what language it's going to be written in. Java or c++ perhaps.

Thanks in advance.

Cerberus 17 Junior Poster

Stumbled onto this site and will probably need some advice over the next year.

I'm a computing student going into my third year.

:cheesy:

Cerberus 17 Junior Poster

Just wondering as it's virtually the same subject where you would start to build a simple operating system whether it be a GUI or CLI. I'm considering attempting something like this for my degree project.