Daniel Puryear

Greenhorn
+ Follow
since Jun 02, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Daniel Puryear

Whoooops! Seems you need to signal the peer plumbing what you really want to do; use something like:

DataFlavor objectflavor = new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType);
12 years ago
Hi All,
Want to rearrange a container hiearchy using DnD (Yes, I know it does not have to be DnD.) Have set-up the usual sample DropSource and DropTarget using some of the code from Core SWING Advanced Programming
By Kim Topley. Have Eclipse watching both sides of the transfer. What I'm seeing on a MOVE that surprised me for the LocalProxy is that the DropTarget.getTransferData(targetFlavor) is returning an unparented "deepCopy" of the referenced object passed in the ComponentTransferable.getTransferData(DataFlavor fl).

Its easy to see that would be the case transferring out of a VM to the peer layers but just did'nt think it was to be the case within a local application.

Is this the expected behavior of the DnD LocalProxy MOVE??
12 years ago
I have built up a simple GUI builder tool that I use to experiment with different layout managers and general coding exercises. Now I'm playing with a simple ( or maybe it will become not so simple) code generator that will unwrap the root container and spew out source code that can be compiled to recreate the UI structure.

Well, I guess I've gone brain dead because for the life of me, I can not recall ever explicitly testing a class to determine if its an inner class, anonymous class, component member class, etc.

With the .getClass().getName() its easy to screen out the anonymous classes with a test for the '$' delimiter, but the question becomes "Is there a more formal test that can be applied?" such as using ancestry. Would appreciate anyone's experiences in unwrapping and code generation.

If I ever get it unscrewed to the point I'm not embrassed by the code I'll post it back here for the next person's query. Thanks All,
- Dan
13 years ago
Keystrokes are normally delivered to the object with the "input" focus, e.g. your JTextField undergoing edit. Any object can listen in on the Keyboard by registerning as a listener. Its generally easier to start by extending the KeyAdapter class, such as ....
//inner class >>
class myKeyAdapter extends java.awt.event.KeyAdapter {
public void keyPressed(java.awt.event.KeyEvent event) {
//jump back out to your base class
keyPressActions(event);
}
}
//in your base class, put the "do it" code
protected void keyPressActions(java.awt.event.KeyEvent event) {
int keycode = event.getKeyCode();
Object object = event.getSource();
if (object instanceof ValueLabel){
if (keycode == java.awt.event.KeyEvent.VK_UP ){
ValueLabel vl =(ValueLabel)getPreviousTarget(((ValueLabel)object).getProperty());
vl.requestFocus();
}
else if (keycode == java.awt.event.KeyEvent.VK_DOWN ){
ValueLabel vl =(ValueLabel)getNextTarget(((ValueLabel)object).getProperty());
vl.requestFocus();
}
else if (keycode == java.awt.event.KeyEvent.VK_ENTER ){
ValueLabel vl = (ValueLabel)object;
showEditor(vl);
}
}
else if (object instanceof IPropertyEditor) {
if (keycode == java.awt.event.KeyEvent.VK_ENTER ||
keycode == java.awt.event.KeyEvent.VK_TAB) {
retireEditor((IPropertyEditor)object);
}
}
event.consume();
}
then register that adapter in any class you want to actually processs the KeyPress events...
addKeyListener(myKeyAdapter );
you could add it to each of the editor panels, but from description, I'd probably add it to their container and callback on each on the buttons action code. Hope this helps..
15 years ago
Chris,
If you truely mean Frame, it can't be added to any other lower level container because its under pinnings (aka Peer class) is a true native Window on the host's operating system (Windows, Solaris, AIS, etc...).
It has very special "helper" classes that enable it to interface with the OS (Window location, size, etc.) It looks like you already have the hard part of your problem solved. As was pointed out, there are a baZIllion samples out there to "flash" through a deck of images. Come back again if you don't find one appropriate for your needs.
15 years ago
You'll need to implement you own flavor of the list model used by the JCombobox to re-order or "map" the indices in the model. Specifically, "extend AbstractListModel implements MutableComboBoxModel"
15 years ago
Basically, you need to add a FocusListener to each of the cell renderers involved. Normally, the cells use the DefaultTableCellRenderer which extends JLabel assuming they are not editable. You can create your own renderer and attach it as needed. If the cell is editable, when you tab into the cell, you're actually on a cell editor, not the cell itself.
The JTable is a VERY complex 'family' of inter-related components - See the JavaTutorial for the gory details or come back if you add additional info...
15 years ago
What Listener interfaces have you implemented? If you want to work at the VK_ENTER level, use the KeyListener. If you want to work at the symantic level, use the ActionListener...
15 years ago
Have a JPanel with JPanels arranged in a Gridbag grid. Have resizing logic that uses MouseListener and MouseMotionListener that permits the user to click and resize the grid of JPanels, pretty straightforward stuff really. Mouse hovers over a sweet spot and the cursor changes to Cursor.E_RESIZE_CURSOR to signal a resize is enabled; user MouseDowns to get a visual cue of the partition location; user drags partition to new location; user releases Mouse to set the new PrefferredSizes etc.
Have used the little thing for several years as a simple "PropertyEditor" panel embedded in an application Frame. Now the rub, currently using 1.4.02 and have the PropertyEditor added to a floating modal JDialog. Everthing works as expected, EXCEPT Cursor.E_RESIZE_CURSOR is apparently being reset to Cursor.DEFAULT by something up the food chain, or I've done something stupid to the JDialog container that doesn't permit anything but the DEFAULT( which I don't believe to be the case.)
Has anyone had a similar situation or have some clues as the wandering cursor dilimia...
15 years ago
I've been doing the Java thing since '96 and have been doing the .NET thing for only 6 months. I started in C# just because I wanted to pick up the new language but then quickly reverted to J# since everything I could do in C#, I could do in J#. I have ported a serious JDK 1.1.4 charting application to the .NET with VERY little difficulty. I've also played with the new J# supplement that picks up many of the Swing components and the new .util classes in prep for another port to the customers .NET environment.
That having been said, I don't think anyone should be confused about the role of J#. J# is intented to help migrate the PROGRAMMERS to the .NET, not the applications. It should not be the basis on which to formulate a decision about how best to develop and support cross-platform applications.
For a Windows environment, .NET has much to offer in terms of performance and programmer convenience and it will be around for a VERY long time. Since J# has always had the design interface into the Windows Forms; us Java GUI programmers will slowly migrate to the Forms designer as we get more comfortable with the forms. (Windows GUI components have always had a richer event model than the Swing) You can (I have) mix and match J# and C# classes freely - I have not had any serious inter-op problems yet. For serious low level Windows interface coding, I'd switch to C#.
Just some thoughts as I read your post ---
- Dan
15 years ago
I'd like to deploy an app in a standalone jar file, but instead of pulling in entire libraries of jar files, I'd like to start with the main class and walk backwards, pulling in ONLY the classes neeeded by the application. I use to use Visual Cafe and it did it auto-magically but I'm now using Eclipse with occasional use of Ant with batch commands.
Would anyone like to share some Ant task or the like. It would sure save a lot of time! I'll post back if/when I get a process working...
15 years ago
I'd like to deploy an app in a standalone jar file, but instead of pulling in entire libraries of jar files, I'd like to start with the main class and walk backwards, pulling in ONLY the classes neeeded by the application. I use to use Visual Cafe and it did it auto-magically but I'm now using Eclipse with occasional use of Ant with batch commands.
Would anyone like to share some Ant task or the like. It would sure save a lot of time! I'll post back if/when I get a process working...
-Danman
15 years ago
WoW! You do have quite a chore ahead of you! I suggest you start looking into a Java based GUI builder application that has source code available and then tweek/tailor it down to fit your needs. There is an enormous amount of code required to do what you described in a professional manner. Just think of some of the things envolved; layout management, color management, perferrence management, Z-order and focus management, and, and, and etc.
Since it sounds like you are only at the Panel level, you'll need to go back to the JDK to check-out MouseListener and MouseMotionListener, Undo, and many, many,...others. Basically, code up some template "components" that get added to the target panel at the location of the mouse when the mouse button is released following a drag from the template's "tag" component that's the source of the drag operation.
Good Luck,
- Dan
15 years ago
I implemented just such a system several years ago using Sybase. Any client, anywhere in the world was made aware of updates concurently and in real time. This is not an enormous undertaking, but it is also non trival.
You develop a high speed, robust JDBC proxy server that sits just outside the DB. The proxy basically is a two-way pass-thru server for the bulk of the JDBC stuff such as ad hoc queries, etc. However, for those cases requiring multi-cast notification everthing is handled via stored procedures on the DB, of course. Then buried within the stored procedure(s) is a call to a custom system stored procedure that communicates with the proxy. The proxy then iterates thru it list of clients and passes the "event" ResultSet back to each of the clients. You will be tailoring the client side JDBC drivers to include callback hooks for use by the proxy. RMI, as suggested earlier, is a relatively painless methodology since most of the infrastructure code is already done for you. Or if you'r really breave, roll your own messaging protocol, just be sure to take into account the various bandwidths of the pipes through which the clients may be connected.
While I'm not familiar with Oracle outside of their SQL dilect, its my understanding from conversations with others that the big O already has a packaged solution to your problem
- Dan
15 years ago
Well, actually, I don't believe you'll find setHorizontalAlignment as a requirement in the ListCellRenderer interface or the DefaultListCellRenderer implementation. But, yes, if you write your own renderer that implements the ListCellRenderer, e.g provide the getListCellRendererComponent() callback for the JComboBox, then register the renderer with the JComboBox, it will use your new renderer. Then, of course, you can base your new renderer on something like JLabel, which DOES have a setHorizontalAlignment.
I found my family of renderers that I originally had completed for a JTable application - Thanks, Dan
15 years ago