Sagewire Logo

java gui RSS Feed

Recent Posts View Recent Posts | View Archived Posts

Message from Roedy Green
Most recent post: 10/28/2007
4 authors and 6 replies.

I was experimenting with a disk fragmenter called DiskTrix. During the
install it said that Vista had turned off maintaining last access
date, and offered to turn it on. I was surprised to discover this was
a configurable feature.

Does anyone know how to control this without using DiskTrix. Vista
help doesn't seem to have anything on it.

wrote in message some JAVA to set last access date, but often Windows ignores
me when I try to set the access date on directories. I haven't yet
figured out why.
--
Roedy Green Canadian Mind Products
The JAVA Glossary
http://mindprod.com read more about last access date


Message from Chanchal
Most recent post: 10/26/2007
2 authors and 2 replies.

Hi All,

I'm trying to add a JLable 'jLable2 to another JLabel 'jLabel1'. But
jLabel2 isn't getting displayed.

My code is

import JAVAx.swing.*;

public class LabelTest extends JFrame {

public LabelTest(){

setDefaultCloseOperation(JAVAx.swing.WindowConstants.EXIT_ON_CLOSE);
JLabel jLabel1 = new JAVAx.swing.JLabel();
jLabel1.setText("jLabel1");
JLabel jLabel2 = new JLabel();
jLabel2.setText(" TEXT ");
jLabel1.add(jLabel2);
getContentPane().add(jLabel1, JAVA.awt.BorderLayout.CENTER);
pack();
} public static void main(String args[]) {
LabelTest lTest = new LabelTest ();
lTest.setSize(400,300);
lTest.setVisible(true);
}

}

Please advice on how I can make jLabel2 visible.
Thanks in advance

Chanchal read more about JLebel as a container


Message from marcussilfver
Most recent post: 10/26/2007
2 authors and 5 replies.

I am completely new to implementing drag and drop.

I have made a class called DropPanel that extends JPanel. DropPanel
implements the DropTargetListener interface. I place a DropPanel as a
component of a JPanel and executes my application...

The wierd thing is that my dropPanel.drop method is called even if I
drop the draggable outside my DropPanel (on the JPanel that contains
the DropPanel).

This behaviour forces me to do a check in my drop method for the
dropPanel's bounds and compare this with the mouse position and reject
the drop if it is outside dropPanel.

Is it supposed to be like this? read more about drag'n drop: why does the parent also become a droptarget


Message from Bruintje Beer
Most recent post: 10/25/2007
4 authors and 6 replies.

Hi,

I am trying to start a JAVA app with webstart. I get the following error

Missing signed entry in resource:
http://localhost/formdesigner/lib/xercesImpl.jar

The xercesImpl.jar is jarsigned

any idea

Johan read more about JAVA webstart problem


Message from Chanchal
Most recent post: 10/24/2007
2 authors and 2 replies.

Hello All,
I have a JSplitPane on a JFrame. Left side of the JSplitPane contains
a button with an image on it. I want the image to get resized along with the button when the divider
of the JSplitPane is dragged. Kindly advice how this can be achieved.

This is my code

import JAVAx.swing.*;

public class NewJFrame extends JFrame {

JButton jButton1;
JButton jButton2;
JSplitPane jSplitPane1;

public NewJFrame() {
jSplitPane1 = new JSplitPane();
jButton1 = new JButton();
jButton2 = new JButton();

setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
jButton1.setIcon(new ImageIcon(getClass().getResource("/
background1.png")));
jSplitPane1.setLeftComponent(jButton1);

jSplitPane1.setRightComponent(jButton2);

getContentPane().add(jSplitPane1,
JAVA.awt.BorderLayout.CENTER);

pack();
} public static void main(String args[]) {
new NewJFrame().setVisible(true);
}

}

Thanks in advance

Chanchal read more about Image on a button


Message from timtech
Most recent post: 10/23/2007
3 authors and 5 replies.

Given the offset from the start of an HTML document, how I can
translate this into the offset when the HTML is rendered in a
JEditorPane? e.g. in the HTML document (not strict HTML but still
renders):

<HTML>test</HTML>

"test" starts at offset 6 in the HTML - but in the JEditorPane only
"test"'d be displayed so it'd start at offset 0 - if I wanted
to highlight it for example. You can imagine more complicated
documents...

Any ideas greatly apprieciated including if I can use an alternative
to the JEditorPane.

Thanks, read more about JEditorPane and HTML offsets


Message from Chanchal
Most recent post: 10/23/2007
3 authors and 3 replies.

Hi All,

Is there any way tooltip text of a JButton can be shown always, rather
than it get displayed on mouse over of the JButton

Thanks in advance

Chanchal read more about ToolTip text for JButton


Message from h4fun
Most recent post: 10/23/2007
5 authors and 8 replies.

Hello,

I=B4ve a question for all... anybody has a JAVA telnet app for
comunicate with cisco routers?I=B4ve this features in vbscript , but I want to make a application
with
the regular admin operations, like backups, show interfaces, cable
modems, SNR, dhcp id=B4s, etc, etc...Anyone can help me with this?Some usefull links or open source app are welcome.Thks read more about Cisco and telnet


Message from lemmi
Most recent post: 10/18/2007
3 authors and 7 replies.

Hi there,

I have an application that uses a JScrollPane to display a component
that will be resized every once in a while. At the same time of the
resize I also want to set a new position for the resized component.
E.g. I am doubling the size of the component and want to change its
location within the viewport so that the component stays centered.
What is the best way to accomplish this without seeing a flickering
behaviour?

Dirk read more about JScrollPane resize / new location question


Message from Irian
Most recent post: 10/17/2007
3 authors and 3 replies.

Hello everyone,

is there a (simple) way to let a JTable behave like the Tables in many
Windows applications? Primarily I want the following: If one column is
resized by hand, only the following columns (all right neighbors)
should moved (not all other columns resized). The size of the screen
should only used for a "default" column width, but the user should be
able to make the JTable wider than the application (resulting in a
horizontal scrollbar).

Flo read more about JTable - Windows Table Behavior?


Message from Florent Georges
Most recent post: 10/17/2007
2 authors and 2 replies.

Hi

I am discovering the Swing's tree API. I am building a
tree one node after the other (the nodes reflect different
steps of a long-running process).

The problem is that the nodes added after the construction
of the tree aren't shown. I guess I have to tell the tree
in some way that the tree model has changed, but I do not
know how.

Below is a full simple sample that reproduce the same
issue I have, I think:

import JAVAx.swing.JFrame;
import JAVAx.swing.JTree;
import JAVAx.swing.WindowConstants;
import JAVAx.swing.tree.DefaultMutableTreeNode;
import JAVAx.swing.tree.DefaultTreeModel;

public class TreeAddNodes
{
public static void main(String[] args)
{
// first part of the model
DefaultMutableTreeNode root =
new DefaultMutableTreeNode("node 1");
root.add(new DefaultMutableTreeNode("node 2"));
root.add(new DefaultMutableTreeNode("node 3"));

// the model and the tree
JTree tree = new JTree(new DefaultTreeModel(root));

// second part of the model, NOT SHOWN!
root.add(new DefaultMutableTreeNode("node 4"));
root.add(new DefaultMutableTreeNode("node 5"));

// GUI boilerplate
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(
WindowConstants.EXIT_ON_CLOSE);
frame.setSize(200, 200);
frame.add(tree);
frame.show();
}
}

Any comment greatly appraciate read more about JTree, updating model and DefaultMutableTreeNode


Message from Qu0ll
Most recent post: 10/16/2007
3 authors and 9 replies.

Is there any reason to use a custom class loader with an applet? I have an
applet in which I only want to load a particular class if the corresponding
content type is required to be rendered by that applet so that the initial
applet load is as quick as possible. I have considered using a custom class
loader whereby the applet'd start a new thread in the init() method
which invokes this loader to download a XYZContentRenderer class in the
background for example. But then I thought that I still need to cast the
resulting class to XYZContentRenderer so that reference to
XYZContentRenderer in the casting'd already cause this class to be
loaded when the applet is loaded.

So therefore I see no benefit from using a custom class loader with an
applet. Is this correct? Is there any other way I can achieve what I am
trying to do here?

--
And loving it,

-Q
_________________________________________________
Qu0llSixFour@xxxxxxxxxxx
(Replace the "SixFour" with numbers to email me) read more about Applets and custom class loaders


Message from cb17890
Most recent post: 10/16/2007
6 authors and 9 replies.

Hi, I'm a new JAVA Programmer and need some help with my homework. My
homework is a multi-part assignment.

My assignment is to modify the code to find and print the sum of the
same series from 1/2 through 1/n, where n is read in from a data
file. The file series1.dat which contains a single positive integer,
can be found in the common area of my personal K: drive. My code
that I have written isn't correct. A lot of error messages occur.

The code to modify:

import JAVA.util.Scanner;
import JAVA.io.*;

public class Summations
{
public static void main(String[] args) throws IOException
{
int value;
int sumPart = 0;

// The first part of the text.
System.out.print("The summation of the series");

// Loop from 2 to 65536, double value each loop.

for (value = 2; value <= 65536; value = value * 2)
{
sumPart = sumPart + value;

if (value >
2)
{
System.out.print(" + ");
}
System.out.print(" 1/" + value);
}
System.out.print(" = 1/" + sumPart + " ");

// Calculate the results.
double calced = 1 / (double) sumPart;
System.out.println("(" + calced + ")");
}
}The code that I have written to complete the assignment is:

import JAVA.util.Scanner;
import JAVA.io.*;

public class Summations
{
public static read more about Files & Methods


Message from Jason Cavett
Most recent post: 10/15/2007
2 authors and 2 replies.

I'm curious - how do I know what component has focus when I need to
pop up a menu to complete a task.

For example, in my JTree, I have a popup menu that comes up when I
right click on the tree. Well, the JTree is the "real" object that
has focus (for a paste/cut/copy/whatever), but now that the menu is
shown, JAVA thinks it is the thing to have the real focus.

Hopefully that makes sense.Thanks read more about Menu Removes Focus


Message from Bruintje Beer
Most recent post: 10/14/2007
6 authors and 12 replies.

Hi,

I have problem with a piece of code (see below). When the text is rotated on
my panel it seems that the coordinate system is corrupt. If I put something
on x,y = 100, 200 it looks that the object is put somewhere else. I think it
has to do with the rotation. How can I go back to the norm coordinate
system/

PS : The rotation works fine for the first time

Johan

void paintComponent() {
Graphics2D g2 = (Graphics2D)g;

AffineTransform af = new AffineTransform();
af.translate(100.,50.);
af.rotate(Math.PI / 2);
FontRenderContext renderContext = new
FontRenderContext(null, false, false);
g2.transform(af);
TextLayout layout = new TextLayout("This text is rotated",
g2.getFont(), renderContext );
layout.draw(g2, 0, 0);
} read more about rotating text problem


Message from Karsten Wutzke
Most recent post: 10/14/2007
3 authors and 5 replies.

Hello!

When using a custom cell renderer (JLabel subclass), I noticed the
border of a selected item isn't drawn. How can I achieve a border
like with the default renderer, the "yellow dots" around the entries,
as with a standard JList or JTree for example.

How do I do it? Change the JLabel super class to ...?

Karsten

PS: I need icons to be displayed on the left hand side. read more about List cell renderer with JLabel: selected border


Message from hiwa
Most recent post: 10/12/2007
3 authors and 6 replies.

The http://www.physci.org/codes/tame/ is corrupted.
Please recover the valuable page, please! read more about Revive tame page


Message from Blade_runner
Most recent post: 10/12/2007
3 authors and 3 replies.

Hi can someone please help me,i have a table that one of the cell has
a combobox,i wish to add a calendar to the combobox.

Thank you. read more about Table cell with a combobox that has a calendar inbeded to the combobox


Message from H?kan Lane
Most recent post: 10/11/2007
2 authors and 3 replies.

How do I underline a specific node in JTree? I have searched a lot for
it on the web, but I did not find anything that has worked. I have been
creating the tree by adding DefaultMutableTreenode instances. No changes
to the look and feel or to the Renderers have been implemented in the
code for the tree part. Thanks in advance.

Håkan Lane read more about Underlining a node in JTree


Message from RedGrittyBrick
Most recent post: 10/11/2007
4 authors and 13 replies.

In a dialogue box, I want to display some text word-wrapped. I use a
JTextArea and set word wrapping on.

However, the height of the dialogue seems to be incorrectly based on the
Textarea being one line high, (it is two lines high when wrapped).

The println statements show
Pref JAVA.awt.Dimension[width=352,height=16]
Wrap set
Pref JAVA.awt.Dimension[width=330,height=16]
Note that the width is reduced but the height is wrong.
Packed
Size JAVA.awt.Dimension[width=330,height=16]
No change due to pack()
Size JAVA.awt.Dimension[width=330,height=32]
But after closing, the height is correct (32)!

Qs:
Am I doing something wrong?
Is there a better way to word-wrap some text in a dialogue?

------------------------- 8< ----------------------
import JAVA.awt.Component;
import JAVA.awt.Dimension;
import JAVA.awt.event.ActionEvent;
import JAVA.awt.event.ActionListener;

import JAVAx.swing.BorderFactory;
import JAVAx.swing.Box;
import JAVAx.swing.BoxLayout;
import JAVAx.swing.JButton;
import JAVAx.swing.JComponent;
import JAVAx.swing.JDialog;
import JAVAx.swing.JFrame;
import JAVAx.swing.JLabel;
import JAVAx.swing.JPanel;
import JAVAx.swing.JTextArea;
import JAVAx.swing.SwingUtilities;

public class TestErrorDialog {

public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new TestErrorDialog();
}
}) read more about JTextArea size problem.


Message from H?kan Lane
Most recent post: 10/10/2007
7 authors and 13 replies.

I have built an application based on JFrame and a BorderLayout with
some added components. I have some very real problems with controlling
how it behaves. Components aren't necessarily shown until I resize the
window. How do I solve that? I assume that it is some basic Swing
methodology that I do not know. You may run the application from
http://cafka.econ.au.dk/launcher.jnlp . Thanks in advance.

Håkan Lane read more about Unpredictable Swing behaviour


Message from Karsten Wutzke
Most recent post: 10/10/2007
4 authors and 4 replies.

Hello!

I have a few settings that are controlled via menu items.

For binary values (true/false or on/off):
Is it better to have regular menu items (JMenuItem) with changing text
or better use toggle menu items (JCheckBoxMenuItem) with constant text
where the check represents on/off state?

For 1 out of n selections:
Basically the same question as above, just with JMenuItem/s vs.
JRadioButtonMenuItem's... (I have to check whether using regular
JMenuItems makes sense at all...)

What are the pros/cons here?

TIA
Karsten read more about Usability: Which (menu) button?


Message from tony
Most recent post: 10/7/2007
2 authors and 3 replies.

Good day.
I try to align image and text by center (on horizontal line) in JTable
cell.
I use "<html><img src="..." />Some text</html>" as a getValue. A text
is now aligned with bottom edge of image (as I can see it).
Does anybody know how to do center them?

Tony. read more about Align of images and text in "[code][/code]..."


Message from Bob
Most recent post: 10/2/2007
3 authors and 4 replies.

I am no expert at Font and graphics. When I show(font = "Vrinda",
PLAIN, 8 size) it looks bad on screen using graphics.drawString...in
fact unreadable. I open Microsoft Word and this font looks ok on the
screen. When I print from our app, things look ok. read more about Fonts


Message from mearvk
Most recent post: 10/1/2007
3 authors and 3 replies.

Trying to get a glasspane to intercept mouseDragged events and let the
rootpane's GUI still function. Tried doing something like setBounds on
the glasspane but no luck. Also tried doing a glasspane.setVisible on
the mouseEnter and mouseExit events and still no luck. Perhaps it
won't detect the mouse re-entry bc the glasspane is invisible? In
which case I'd need to make a listener on my JInternalFrame too? I will
post some code in case its just a stupid mistake. And advice is
appreciated in direct ratio to how good it is ;-)

Here we go:

(It's a Digital Image Processor - DIP)[START CODE]package dip.listeners;

import dip.jcomponents.*;

import JAVAx.swing.event.*;
import JAVA.awt.event.*;
import JAVA.awt.*;

public class DIPMouseListener extends MouseAdapter implements
MouseMotionListener
{
DIPGlassPane glassPane;

Point currentLocation;
Point mouseDraggedFrom;
Point mouseDraggedTo;
Point mouseReleasedAt;
Point mouseClickedAt;
Point mousePressedAt;

public DIPMouseListener(DIPGlassPane glassPane)
{
this.glassPane=glassPane;
}

public void mousePressed(MouseEvent me)
{
mousePressedAt=new Point(me.getX(),me.getY());
//System.out.println("Mouse pressed at point "+me.getX()
+","+me.getY()+".");
glassPane.updateRect(me.getX(),me.getY(),0,0);
}

public void mouseEntered(MouseEvent me)
{
//System.out.println("Mouse entered at point "+me.getX()
+","+me.getY()+".");
glassPane.setVisible(true);
}

public vo read more about Glasspane Woes


Message from Chanchal
Most recent post: 9/29/2007
3 authors and 6 replies.

Hi All,

I have five classes MyFrame, MyContainerPanel,MyPanel, MyButton and
MyLine.
MyFrame contains MyContainerPanel, MyContainerPanel contains MyPanel
and MyPanel
contains MyButton.

Constructor in MyButton takes an object of MyContainerPanel. So when
MyPanel is created an instance of MyContainerPanel is passed, which is
in turn passed to the contained MyButton instance.

MyButton has an inner class ML which extends MouseInputAdapter and the
mouseClicked() method is defined.

Now when MyButton is clicked, a function addLine() in MyContainerPanel
should be called, which will add a MyLine instance to the contaied
MyPanel instance. My problem is that when this add() is called, the
overrideen paintComponent() method in MyLine isn't getting called.

Please find the code..import JAVAx.swing.*;
import JAVA.awt.event.*;
import JAVA.awt.*;
import JAVAx.swing.event.*;

public class MyButton extends JPanel {
MyContainerPanel mp;
public MyButton(MyContainerPanel mp){
this.mp = mp;
addMouseListener(new ML());
setBorder(JAVAx.swing.BorderFactory.createLineBorder(new
JAVA.awt.Color(0, 0, 0)));
}

class ML extends MouseInputAdapter{
public void mouseClicked(MouseEvent e){
System.out.println("MB CLICKED");
mp.addLine();
}
}
}

import JAVAx.swing.*;
import JAVA.awt.event.*;
import JAVA.awt.*;
public class MyPanel extends JPanel{
MyContainerPanel mp;
publ read more about Repaint not happening when compnent added to panel progrmatically


Message from Chanchal
Most recent post: 9/28/2007
4 authors and 6 replies.

Hi All,

I have a JScrollPane on a JFrame. The JScrollPane contain a JPanel.On
click of a JButton, i'm adding new JButtons to this JPanel, side by
side.

import JAVAx.swing.*;
import JAVA.awt.event.*;

public class DynamicScroll extends JFrame implements ActionListener{

private int buttonCount = 0;
private JButton jButton1;
private JPanel jPanelInScrollPane;
private JScrollPane jScrollPane1;

public DynamicScroll() {
jScrollPane1 = new JScrollPane();
jPanelInScrollPane = new JPanel();
jButton1 = new JButton();

getContentPane().setLayout(null);
jPanelInScrollPane.setLayout(null);

jScrollPane1.setViewportView(jPanelInScrollPane);
getContentPane().add(jScrollPane1);
jScrollPane1.setBounds(40, 40, 320, 80);

jButton1.setText("Add Button");
jButton1.addActionListener(this);

getContentPane().add(jButton1);
jButton1.setBounds(150, 170, 120, 23);

}

public void actionPerformed(ActionEvent evt) {
JButton newButton = new JButton("Button "+ buttonCount);
newButton.setBounds( buttonCount * (100)+10, 5, 100, 50);
jPanelInScrollPane.add(newButton);
buttonCount ++ ;
jPanelInScrollPane.repaint();
jPanelInScrollPane.validate();
}

public static void main(String args[]) {
DynamicScroll ds = new DynamicScroll();
ds.setSize(400,300);
ds.setVi read more about Programatically displaying scrollbars of a JScrollPane


Message from Chanchal
Most recent post: 9/27/2007
5 authors and 6 replies.

Hi,
Is there any was we can mention size of component when we are using
border layout?Myproblem is that I have 3 JPanels placed side by side
on a JFrame with border layout. But I need the first and last JPanels
to occupy 25% each of the width and the middle one to occupy 50%. I'm
using Border Layout so that the JPanels will resize themselves when
the JFrame is resized.

Thanks in advance... read more about Setting component size while using border layout


Message from leshin
Most recent post: 9/27/2007
2 authors and 2 replies.

I use JDIC package to create a system tray icon for my application and
would like to display the pop-up menu when left clicking on the system
tray icon. But, unfortunately, it seems JDIC system tray icon can only
support right clicking to show the pop-up menu. Is there anyone can
suggest a solution for me. Thanks. read more about how to set left click to display pop-up menu for system tray


Message from William Z.
Most recent post: 9/27/2007
2 authors and 2 replies.

DISCONTIGUOUS_TREE_SELECTION allows me to select and highlight
multiple JTree nodes. I then right click on the highlighted selections
to bring up a popup menu which will affect the configuration of those
nodes, but the problem is when I make that initial right click on the
highlighted nodes, all the selections go away and I'm left w/ a single
selected tree node.

Any ideas how to keep the selection count up when right clicking on
any one of the multiple highlighted nodes and not have them dissappear
except for the one I right click on? read more about keeping multiple highlighted tree nodes selected


Message from lemmi
Most recent post: 9/26/2007
4 authors and 7 replies.

Hi,

can anyone tell me whether it is possible to get rid of the warning
message at the bottom of webstart windows when the windows are
children windows without decoration? My application window is a JFrame
and it opens up several Window instances. The JFrame is the parent
window and already shows a warning message to the user, why do all the
children winodws have to do the same? Are not popup menus also just
windows without decoration? Why do not they show the warning message?

--Dirk

P.S.: the webstart demo can be found at http://www.dlsc.com read more about Webstart windows warning message


Message from Chanchal
Most recent post: 9/25/2007
3 authors and 4 replies.

Hi All,I have a component "JPResourceBox" which extends JPanelimport JAVA.awt.event.MouseAdapter;
import JAVA.awt.event.MouseEvent;
import JAVAx.swing.JMenuItem;
import JAVAx.swing.JPopupMenu;

public class JPResourceBox extends JAVAx.swing.JPanel {

/** Creates new form JPResourceBox */
public JPResourceBox(JPWorkspacePanel parent) {
initComponents();
} private void initComponents() {
jLabel1 = new JAVAx.swing.JLabel();

setLayout(new JAVA.awt.BorderLayout());

setBorder(JAVAx.swing.BorderFactory.createEtchedBorder());
jLabel1.setText("jLabel1");
add(jLabel1, JAVA.awt.BorderLayout.CENTER);

}

private JAVAx.swing.JLabel jLabel1; public void setText(String buttonText){
this.jLabel1.setText(buttonText);
}
}I am adding instances of JPResourceBox to a JFrame programatically on
a button clickpublic class NewJFrame extends JAVAx.swing.JFrame {

private JAVAx.swing.JButton jButton1;

public NewJFrame() {
initComponents();
}

private void initComponents() {
jButton1 = new JAVAx.swing.JButton();

getContentPane().setLayout(null);


setDefaultCloseOperation(JAVAx.swing.WindowConstants.EXIT_ON_CLOSE);
jButton1.setText("jButton1");
jButton1.addActionListener(new JAVA.awt.event.ActionListener()
{
public void actionPerformed(JAVA.awt.event.ActionEvent
evt) {
jButton1A read more about repaint issue when compnent added to frame programatically


Message from AimsLife
Most recent post: 9/25/2007
3 authors and 3 replies.

Hi,

I am using jdk1.5 development kit for development. I am developing
desktop base application. I created a frame (JFrame frm), added two
buttons with label "OK" and "Cancel", some text fields and labels. I
want to know, how I can define default behavior of frame on key
stokes, mean to say, if I pressed ESC key any time then frame should
perform "Cancel" behavior and "OK" behavior on press ENTER any time.
Is it possible without adding listener in all components?

Regards,
-aimslife read more about Default key behavior of JFrame


Message from Chanchal
Most recent post: 9/25/2007
2 authors and 2 replies.

Hi All,

Is ther anyway cells can be merged row-wise in JTable? Any sample
code available?

Thanks in advance

Chanchal read more about JTable - Merging cells


Message from Mungo Henning
Most recent post: 9/24/2007
5 authors and 6 replies.

Hi Folks,
Okays, although I'm not the oldest person here I'm struggling to understand
an issue in MVC
with a Swing JAVA application.
If someone could point me in the right direction I'd be obliged.

Here's the problem: I'm writing a little application and the idea of MVC
tickles me such that I
want to learn about it and implement it to fully appreciate MVC.
Hypothetically, if I have a plain "String" object in my model and a
"JTextField" object on my display, I
would software connect these by telling the Model when the end user changes
the textfield, and using
the Observer pattern tell the JTextField (and any other viewers) when the
model data changes.

So if the end user types the first character in the JTextField then this
JTextField nudges the associated
Model and says "data has changed; you'd better update your String".
The model then updates its String object and then it has to tell ALL its
viewers that its data has changed.
These viewers include the originating JTextField, hence we get a mutual
loop: A calls B and then B calls A which
leads to A calling B again...

Knowing that others have solved this, how do people break this recursion?
I'd think that whomever informs the Model that the data has changed ought
not be on the list of Viewers that
the model should subsequently contact.

MVC sounds wonderful; someone enlighten my ignorance please.

Thanks in advance

Mungo :-) read more about MVC: how do I stop mutual recursion?


Message from ":-o"
Most recent post: 9/23/2007
2 authors and 2 replies.

Thanks,

Based on Events/conditions , I need to set the text in a JTable cell from
default color (black) to background color (white) to "hide" the text. These
conditions will force back/forth to the foreground coloring.

Is any one cell containing text a JTextField or JLabel?

How'd I get a reference to the component to make the setForeground() call.

Thanks again..... read more about JTable (setForeground on text in cell)


Message from Karsten Wutzke
Most recent post: 9/22/2007
4 authors and 8 replies.

Hello!

I'm wondering about repeatingly occurring actions in an application or
application framework. Most often, actions are repeated *many* times
inside an application, today most of them also need to be localized so
that the actual button will reflect the user readable state.

"ok" ----"en_US"----> "OK", "Accept", "o"
"ok" ----"de_DE"----> "OK", "Akzeptieren", "a"
"ok" ----"fr_FR"----> "OK", "Accepter", "a" ???

"cancel" ----"en_US"----> "OK", "Cancel", "c"
"cancel" ----"de_DE"----> "OK", "Abbrechen", "a"
"cancel" ----"fr_FR"----> "OK", "Annuler", "a" ???

.
.
.

These actions are:

ok
cancel
yes
no
accept
decline
apply
revert/restore/reset (defaults)
close
retry
next
previous
up
down
back
help

The above are mostly actions that are found in dialogs. Many other
common actions via menus include:

FILE
new
open
save
save as
close
print
exit

EDIT
undo
redo
cut
copy
paste
delete
search
searchon

VIEW
scaleup
scaledown

EXTRAS?
addons
plugins
settings
...?

HELP
help
jreinfo
about

Common popup actions could be:

cut (again)
copy (again)
paste (again)
delete (again)
properties
...

The UPPERCASE entries are groups (e.g. resulting in a JMenu or nothing
as when displaying a JPopupMenu)
... (list not complete)

By concept the approach is comparable to what "icon sets" deliver. An
icon set delivers a set of common images for all kinds of
applications, an "action set"'d deliver localized text, read more about Common actions and translation of text, tooltips, mnemonics...


Message from Qu0ll
Most recent post: 9/22/2007
4 authors and 27 replies.

I know almost nothing about applets so please excuse the possible lameness
of this question.

Can someone tell me if it's possible for an applet to adjust its size (i.e.
the amount of the web page it takes up) when the size of the web page itself
changes? What I mean is that when you increase the size of the browser
window then the web page (HTML) usually automatically adjusts its own size
to accommodate the new browser window size and the contents of the page are
laid out accordingly. Is it possible to have the applet do something
similar? My only experience with applets was when they used to be annoying
little grey boxes but I am hoping that the platform has improved and I can
port my Swing applications to the web (and yes I know about JNLP which is
not what I am looking for).

--
And loving it,

-Q
_________________________________________________
Qu0llSixFour@xxxxxxxxxxx
(Replace the "SixFour" with numbers to email me) read more about Applets automatically resizing when page size changes


Message from Chanchal
Most recent post: 9/21/2007
5 authors and 6 replies.

Hi,

I have JPanel (jPanel1 )on right hand side of a JSplitPane I have
applied GridbagLayout to jPanel1 and added two more JPanels (jPanel2
and jPanel3) to jPanel1. I need to make sure that the size jPanel3 is
not changed when the divider of the JSplitPane is moved. Kindly advice
on how this can be achieved.

If this isn't possible using Gridbag Layout, please advice on how I
can achive the same result

Thanks in advance

Chanchal read more about Gridbag Layout. Fixing size of a component


Message from HESH
Most recent post: 9/20/2007
7 authors and 14 replies.

Hello,

Regarding: Airline Information system project dBase connectivity.
Initially we made GUIs using swing in 1st Iteration.
we tried different layout, & we are ok with that.But as project demand is to make Airline System online.
We were left only with two options to make project either in Applet
or
JSP.
Because by using swings we can make only applications (standalone-
not
web based)Sir, will it be possible to make online application using swing?Secondly we do not have that much time to make AIS in JSP as members
require from learning -to-implement.
So finally we decided to make it in Applet, & for back end we are
using MS-Access or SQL, please suggest us which one will be better to
use.Now we've all the GUIs in applet, but problem arise at the time of
data base connectivity in applet.
I tried by using following code:Following code I just made for Demo purpose as application
System DSN is: AIS
Table Name is: Nameimport JAVA.sql.*;public class JDBCDemo
{
public static void main(String args[]) { try
{

Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection c =
DriverManager.getConnection("jdbc:odbc:AIS");
// connecting with AIS.mdb
Statement st =
c.createStatement(); ResultSet rs =
st.executeQuery("select fName,lName FROM
Name"); // s read more about problem regarding dBase connectivity with Applet


Message from Chanchal
Most recent post: 9/19/2007
<