JScrollPane inside JTabbedPane

2002-11-25 Thread Aleksandr Kravets
Hello,

Does anybody know how to include JScrollPane inside JTabbedPane? I'am
looking for a way to make the whole viewable area of JTabbedPane scroll.

thanks,
Alex

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing



JTabbedPane problem

2003-01-16 Thread Aleksandr Kravets
Hello,

I have a JTabbedPane in which when I click a specific tab I launch
ProgressMonitor that shows progress of file that is being read. After
ProgressMonitor closes, focus on the tab screen is gained, but everything in
it is not showing (blank screen). Only after I click inside the screen will
I see what's in there. Does anyone have any suggestions?

code:
   protected class SCDThread extends Thread{
  public SCDThread(){}
  public void run(){
 /*
 method that gets all data and has
ProgressMonitor
 initialized and updated
 */
 scr.addSizeChainScreen();
 screen6.repaint();
 screens.setSelectedIndex(5);
  }
}

thanks,
Alex

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing



knowing when JComboBox's data has changed

2003-01-28 Thread Aleksandr Kravets
Hello,
I have a custom JComboBox class where I set a ToolTip for each item. It
works in times when I send a populated vector to the class. However,
sometimes I need to send an empty vector and populate it later. How can I
find out in custom JCB class when my vector has changed in number of
elements?
I tried to use ListDataListener, but had problems in implementing it. Also,
I used ItemListener, but it works only when an item had been selected from
JCB at which point it throws NullPointerException and then displays ToolTips
correctly.

thanks,
Alex


___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing



ListCellRenderer

2003-07-29 Thread Aleksandr Kravets
Hi,

I have a JTable in which I use JList as row header. I also alternate
colors of rows between gray and white. Now I need to color some of the
rows of JList in red. What I have is vector of rows that need to be
colored in red, in ListCellRenderer I loop thru this vector and compare
each element to index value of the renderer, if there is a match I set
background to red if not color other way. It seems to be working but in
a strange way. If I have 6 rows and need to color rows 6,4 and 2 the
will be only row 6 colored in red. If I make rows 4 and 2 to be colored
in red only row 4 is in red. It seems renderer colors only last row to
be colored. Don't know what to do. Any help is greatly appeciated.

** code below **
thanks,
Alex

class RowHeaderRenderer extends JLabel implements ListCellRenderer {
   RowHeaderRenderer(JTable table) {
 JTableHeader header =
table.getTableHeader();
 setOpaque(true);

setBorder(UIManager.getBorder("TableHeader.cellBorder"));

setHorizontalAlignment(SwingConstants.LEFT);
 setForeground(header.getForeground());
 setFont(header.getFont());
  }
  public Component getListCellRendererComponent(JList list,
Object
value,
int index,
boolean
isSelected,
boolean
cellHasFocus){
 setText((value == null) ? "" : value.toString());
 for(int i = 0; i < unselectedRows.size(); i++){

if((String.valueOf(index)).equals(unselectedRows.elementAt(i))){
 System.out.println("UNSELECT = " +
unselectedRows.elementAt(i));
 setBackground(new Color(255,51,51));
 setForeground(white);
 }
 else{
 if(index % 2 != 0){
setBackground(white);
setForeground(Color.black);
 }
 else{
 setBackground(gray);
 setForeground(Color.black);
 }
 }
 }
 /*
 if(index % 2 != 0)
setBackground(white);
 else
setBackground(gray);
 */
 return this;
  }
}

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing


JFrame question

2003-07-30 Thread Aleksandr Kravets
Hi,

When I call JFrame from my Applet, JFrame appears with a status bar
saying 'Java Applet Window'. Is there a way to get rid off this status
bar?

thanks,
Alex K

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing


Re: JFrame question

2003-07-30 Thread Aleksandr Kravets
Strange, because when my applet downloads a jar file, there is no status bar. Is
that frame also regular JFrame or something else?

"Farwell, Paul" wrote:

> The only way to get rid of the status bar message (that I am aware of) is to
> sign your applets. Sun has done this by design for any heavyweight window as
> a (reputed) security feature.
>
> -Original Message-
> From: Aleksandr Kravets [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 30, 2003 5:22 PM
> To: Swing Forum
> Subject: JFrame question
>
> Hi,
>
> When I call JFrame from my Applet, JFrame appears with a status bar
> saying 'Java Applet Window'. Is there a way to get rid off this status
> bar?
>
> thanks,
> Alex K
>
> ___
> Advanced-swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/advanced-swing

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing


Re: JFrame question

2003-07-30 Thread Aleksandr Kravets
Got it. Thanks!

"Farwell, Paul" wrote:

> I believe the rule is that the status bar will appear for a heavyweight
> window displayed in a unsigned applet. It doesn't matter whether the window
> is a JFrame, a popup window or (IIRC) a tooltip - provided the window is
> heavyweight. If you don't see the message, your window is a lightweight
> window or you are running in an open/unsecured environment (e.g. a signed
> jar, an altered java.policy file, or running as a standalone Java app).
>
> -Original Message-
> From: Aleksandr Kravets [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 30, 2003 5:33 PM
> To: Farwell, Paul
> Cc: Swing Forum
> Subject: Re: JFrame question
>
> Strange, because when my applet downloads a jar file, there is no status
> bar. Is
> that frame also regular JFrame or something else?
>
> "Farwell, Paul" wrote:
>
> > The only way to get rid of the status bar message (that I am aware of) is
> to
> > sign your applets. Sun has done this by design for any heavyweight window
> as
> > a (reputed) security feature.
> >
> > -Original Message-
> > From: Aleksandr Kravets [mailto:[EMAIL PROTECTED]
> > Sent: Wednesday, July 30, 2003 5:22 PM
> > To: Swing Forum
> > Subject: JFrame question
> >
> > Hi,
> >
> > When I call JFrame from my Applet, JFrame appears with a status bar
> > saying 'Java Applet Window'. Is there a way to get rid off this status
> > bar?
> >
> > thanks,
> > Alex K
> >
> > ___
> > Advanced-swing mailing list
> > [EMAIL PROTECTED]
> > http://eos.dk/mailman/listinfo/advanced-swing

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing


another JFrame question

2003-07-31 Thread Aleksandr Kravets
Hi,

When my Applet loads a JFrame, a user can click inside an Applet and
JFrame will hide. Is there a way to keep JFrame visible until user
closes it and if JFrame looses focus, JFrame is visible a top of Applet
anyway?

thanks,
Alex

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing


Re: AW: another JFrame question

2003-07-31 Thread Aleksandr Kravets
thanks Salvador,

But where exectly do I have to put this code?

Alex

Salvador Richter wrote:

> Maybe JDialog will not be modal even if you say it to be modal.
>
> therefore you can attach your dialog to the browsers frame
>
> use
>
> Container cont = 'your applet';
>
>  while(cont != null)
>   {
> cont = cont.getParent();
>
> if(cont instanceof Frame) return (Frame)cont;
>   }
>   return (Frame)null;
>
> to get attached to the browser.
>
> Salvador Richter
> Web-Applikationsentwickler/Projektleiter
>
> mailto:[EMAIL PROTECTED]
> 
> in-integrierte informationssysteme GmbH
> Am Seerhein 8
> D-78467 Konstanz
> http://www.in-gmbh.de
> 
> Telefon +49 (0) 7531 - 81 45- 0
> Telefax +49 (0) 7531 - 81 45-81

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing


Re: AW: AW: another JFrame question

2003-07-31 Thread Aleksandr Kravets
thanks!

Salvador Richter wrote:

> Hi Alex,
>
> you have to use JDialog instead of JFrame
> and then do it like this
>
> public Frame getBrowserFrame()
> {
>  Container cont = 'your applet';
>
>   while(cont != null)
>{
>  cont = cont.getParent();
>
>  if(cont instanceof Frame) return (Frame)cont;
>}
>return (Frame)null;
> }
>
> JDialog myDialog = new JDialog( getBrowserFrame(), true );
>
> so you will get a browser-modal dialog.
>
> Hope this will help!
>
> Salvador Richter
> Web-Applikationsentwickler/Projektleiter
>
> mailto:[EMAIL PROTECTED]
> 
> in-integrierte informationssysteme GmbH
> Am Seerhein 8
> D-78467 Konstanz
> http://www.in-gmbh.de
> 
> Telefon +49 (0) 7531 - 81 45- 0
> Telefax +49 (0) 7531 - 81 45-81

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing


Re: formatting string as a date

2003-08-05 Thread Aleksandr Kravets
Got it. Thanks!

Colin Vipurs wrote:

> Set your twoDays SimpleDateFormat to be "MM/dd/yy"
>
> >Actually got it working sort of...
> >When I parse date string I have it as 04/03/03 so when done parsing I
> >get year parsed as 0003 not 2003...
> >
> >___
> >Advanced-swing mailing list
> >[EMAIL PROTECTED]
> >http://eos.dk/mailman/listinfo/advanced-swing
> >
>
> --
> Colin Vipurs
> Senior Developer, Page Ready R&D
> The Press Association
> Howden
> E-mail: [EMAIL PROTECTED]
> Telephone: (01430) 455 582
>
> 'Don't you ever touch my puck'
>
> PA News Limited,  292 Vauxhall Bridge Road, London SW1V 1AE. Registered in
> England No. 3891052

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing


Re: Advanced-swing digest, Vol 1 #532 - 2 msgs

2003-08-07 Thread Aleksandr Kravets
Thanks Frank,

So is MappedByteBuffer is really that fast? Also, I tried your suggestion of using
predefined Boolean object -- seems to save at most 3 seconds.

Alex

[EMAIL PROTECTED] wrote:

> Send Advanced-swing mailing list submissions to
> [EMAIL PROTECTED]
>
> To subscribe or unsubscribe via the World Wide Web, visit
> http://eos.dk/mailman/listinfo/advanced-swing
> or, via email, send a message with subject or body 'help' to
> [EMAIL PROTECTED]
>
> You can reach the person managing the list at
> [EMAIL PROTECTED]
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Advanced-swing digest..."
>
> Today's Topics:
>
>1. reading from file ([EMAIL PROTECTED])
>2. Re: reading from file (Frank D. Greco)
>
> --__--__--
>
> Message: 1
> Date: Wed, 6 Aug 2003 11:44:20 -0400 (EDT)
> Subject: reading from file
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
>
> Hi,
>
> I have a pipe-delimited file that I want to read from. As I read each line
> of file, I tokenize it and put each token in an Object[][]. Everything
> works fine, the only problem is that it taks too long to read whole file.
> Is there a way to speed up this proccess?
> Code is below.
>
> thanks,
> webmacaco
>
> code:
> 
>
> grid = file to read from
> example of grid:
> - programName|Files|Files|1|1|1|1|1|1|0|1|1|1|1|1|1|1|1|1|0
> - total lines:  245
> - total tokens: 4900
>
> code for reading file
> -
> Object[][] tableData = new Object[rowNames.size()][columns.length];
> String data = "";
> boolean bool;
> String columnLine = "";
> int i,j;
> for(i = 0,j = 2; i < rowNames.size(); i++,j++){
> columnLine = grid.getLine(j);
> for(int k = 0,m = 4; k < columns.length; k++,m++){
> data = grid.getToken(columnLine,m);
> tableData[i][k] = new  Boolean(data.equals("0")?false:true);
>  }
> }
>
> --__--__--
>
> Message: 2
> Date: Wed, 06 Aug 2003 23:26:10 -0400
> To: [EMAIL PROTECTED],[EMAIL PROTECTED]
> From: "Frank D. Greco" <[EMAIL PROTECTED]>
> Subject: Re: reading from file
>
> At 11:44 AM 8/6/2003 -0400, [EMAIL PROTECTED] wrote:
> >I have a pipe-delimited file that I want to read from. As I read each line
> >of file, I tokenize it and put each token in an Object[][]. Everything
> >works fine, the only problem is that it taks too long to read whole file.
> >Is there a way to speed up this proccess?
>
>  Do you really need to create a brand new Boolean for each
>  element, or do you just merely need to have true and
>  false for each?  If so, why not just use reuse 2 Booleans
>  and skip the 'new' (which is costly).
>
>  Also its not obvious if "grid" is a buffered stream or not.
>  Btw, try NIO... specifically MappedByteBuffer.  Its pretty fast.
>
>  Frank G.
>
> --__--__--
>
> ___
> Advanced-swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/advanced-swing
>
> End of Advanced-swing Digest

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing


re:formatting string as a date

2003-08-10 Thread Aleksandr Kravets
Actually got it working sort of...
When I parse date string I have it as 04/03/03 so when done parsing I
get year parsed as 0003 not 2003...

___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing


formatting string as a date

2003-08-14 Thread Aleksandr Kravets
Hello,

I need to format a String that I get from database which is in form
04/03/03 to 4/3/2003. When formatting today's date, I do the following:

SimpleDateFormat formatter = new SimpleDateFormat("MM/dd/");
calendar.add(calendar.DATE,2);
int day = calendar.get(calendar.DAY_OF_MONTH);
int month = calendar.get(calendar.MONTH) + 1;
int year = calendar.get(calendar.YEAR);
String expire = month + "/" + day + "/" + year;
String twoDays = formatter.parse(expire);

But when I tokenize 04/03/03 and try to format is using:
SimpleDateFormat formatMonth = new SimpleDateFormat("M");
SimpleDateFormat formatDay = new SimpleDateFormat("d");
SimpleDateFormat formatYear = new SimpleDateFormat("");

StringTokenizer dateString = new StringTokenizer("04/03/03","/");
formatMonth.format(dateString.nextToken());

I get error:
java.lang.IllegalArgumentException: Cannot format given Object as a Date

 at java.text.DateFormat.format(DateFormat.java:265)
 at java.text.Format.format(Format.java:116)

What am I doing wrong here?

thanks,
Alex


___
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing