Swings problem.. Urgent
Hi,
In my java application I am using Swings and using around 30 text fields. For almost each and every field i have Key Typed, Key Presssed and Action performed events.
The problem is whenever there is any field disabled and user double clicks that field then it's text is selected and on presssing enter button all the above mentioned evenets are called.
Is there any way by which I can supress the calling of these events in case the field is disabled?
Hoping to get a quick reply as I ned to do it today itself
Thanks in advance
Ankush
Whether I make it non editable or disabled or both it hardly matters.
The action performed, Key Pressed and Key Typed events will be called.
Yes U suggested right, That is one solution but is there any way by which I can attach listeners to fields other than those which are not Editable/Disabled? Or any way by which if field is disabled/non editable then some method is called in which I will do nothing otherwise regular Action Performed, Key Pressed, Key Typed events are called?
Thanks
Ankush
Similar Messages
-
i keep getting the error: boxlayout can't be shared...
what's the problem?
Part of My code:
JPanel CatSubPanel = new JPanel() {
public Dimension getMinimumSize() {
return getPreferredSize();
public Dimension getPreferredSize() {
return new Dimension(400, super.getPreferredSize().height);
public Dimension getMaximumSize() {
return getPreferredSize();
CatSubPanel.setLayout(new BoxLayout(CatSubPanel, BoxLayout.X_AXIS));
if (MULTICOLORED) {
CatSubPanel.setOpaque(true);
CatSubPanel.setBackground(new Color(0, 0, 255));
CatSubPanel.setBorder(BorderFactory.createEmptyBorder(0,1,10,5));
CatSubPanel.add(anotherNewPanel);help! swing problemI don't think so.
I just mentioned there is a Swing forum for posting Swing related questions.
I also gave you a link to a tutorial on How to Use Box Layout. -
[b]the swing problem!,help me[/b]
the code:
JScrollPane p = new JScrollPane(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
ImageIcon icon = new ImageIcon(getClass().getResource("images/275.tif"));
JLabel l = new JLabel(icon);
p.setViewportView(l);
this.getContentPane().add(p);
this.pack();
this.setSize(300,300);
this.setVisible(true);
question: I con't see the picture ,why? is the .tif format problemthe swing problem!,help meIf you know its a Swing problem then you should be posting in the "Swing forum".
You said it works for .jpg images, so the JDK may not support .tif images. -
J2EE StartUp Problem, URGENT.
Hi all!
I'm having a problem since friday with the J2EE Engine Startup. The problem is that MMC says me that the server is running but i can access to the server by anyway. The developer trace of the jcontrol process is:
[Thr 2968] Tue Aug 09 13:59:50 2005
[Thr 2968] JControlICheckProcessList: process server0 started (PID:1544)
JStartupStartJLaunch: program = C:\usr\sap\J2E\JC00/j2ee/os_libs/jlaunch.exe
-> arg[00] = C:\usr\sap\J2E\JC00/j2ee/os_libs/jlaunch.exe
-> arg[01] = pf=C:\usr\sap\J2E\SYS\profile\J2E_JC00_toshiba-user
-> arg[02] = -DSAPINFO=J2E_00_sdm
-> arg[03] = -file=C:\usr\sap\J2E\JC00\SDM\program\config\sdm_jstartup.properties
-> arg[04] = -nodeName=sdm
-> arg[05] = -nodeId=2
-> arg[06] = -syncSem=JSTARTUP_WAIT_ON_2964
-> arg[07] = -jvmOutFile=C:\usr\sap\J2E\JC00\work\jvm_sdm.out
-> arg[08] = -stdOutFile=C:\usr\sap\J2E\JC00\work\std_sdm.out
-> arg[09] = -locOutFile=C:\usr\sap\J2E\JC00\work\dev_sdm
-> arg[10] = -mode=JCONTROL
-> arg[11] = pf=C:\usr\sap\J2E\SYS\profile\J2E_JC00_toshiba-user
-> lib path = PATH=C:\j2sdk1.4.2_08\jre\bin\server;C:\j2sdk1.4.2_08\jre\bin;C:\oracle\WAS\92\bin;C:\oracle\WAS\92\jre\1.4.2\bin\client;C:\oracle\WAS\92\jre\1.4.2\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\j2sdk1.4.2_08\bin;C:\oracle\WAS\92\Appache\perl\5.00503\bin\MSWin32-x86;C:\usr\sap\J2E\SCS01\exe;C:\usr\sap\J2E\JC00\exe;C:\usr\sap\J2E\SYS\exe\run
-> exe path = PATH=C:\j2sdk1.4.2_08\bin;C:\usr\sap\J2E\JC00\j2ee\os_libs;C:\oracle\WAS\92\bin;C:\oracle\WAS\92\jre\1.4.2\bin\client;C:\oracle\WAS\92\jre\1.4.2\bin;C:\Program Files\Oracle\jre\1.3.1\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\j2sdk1.4.2_08\bin;C:\oracle\WAS\92\Appache\perl\5.00503\bin\MSWin32-x86;C:\usr\sap\J2E\SCS01\exe;C:\usr\sap\J2E\JC00\exe;C:\usr\sap\J2E\SYS\exe\run
[Thr 2968] Tue Aug 09 13:59:51 2005
[Thr 2968] JControlICheckProcessList: process SDM started (PID:1556)
[Thr 1188] Tue Aug 09 14:01:01 2005
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] Tue Aug 09 14:01:58 2005
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] JControlMSMessageFunc: receive command:6, argument:1213679940 from Message Server
[Thr 1188] Tue Aug 09 14:10:25 2005
[Thr 1188] JControlMSReadMessage: NiPeek() returns -5 NIETIMEOUT
[Thr 1188] Tue Aug 09 14:15:45 2005
[Thr 1188] JControlMSReadMessage: NiPeek() returns -5 NIETIMEOUT
[Thr 1188] Tue Aug 09 14:20:46 2005
[Thr 1188] JControlMSReadMessage: NiPeek() returns -5 NIETIMEOUT
[Thr 1188] Tue Aug 09 14:26:06 2005
[Thr 1188] JControlMSReadMessage: NiPeek() returns -5 NIETIMEOUT
[Thr 1188] Tue Aug 09 14:31:07 2005
[Thr 1188] JControlMSReadMessage: NiPeek() returns -5 NIETIMEOUT
[Thr 1188] Tue Aug 09 14:36:27 2005
[Thr 1188] JControlMSReadMessage: NiPeek() returns -5 NIETIMEOUT
[Thr 1188] Tue Aug 09 14:41:28 2005
[Thr 1188] JControlMSReadMessage: NiPeek() returns -5 NIETIMEOUT
Then i try to login the visual admin gives me a windows error and the msg_server process shuts down alone. Then i restart that node and agregate the following lines to the trace:
Thr 1188] Tue Aug 09 14:42:25 2005
[Thr 1188] *** ERROR => MsINiRead: NiBufReceive failed (NIECONN_BROKEN) [msxxi.c 2488]
[Thr 1188] *** ERROR => MsIReadFromHdl: NiRead (rc=NIECONN_BROKEN) [msxxi.c 1652]
[Thr 1188] Tue Aug 09 14:42:27 2005
[Thr 1188] ***LOG Q0I=> NiPConnect2: SiPeekPendConn (10061: WSAECONNREFUSED: Connection refused) [nixxi_r.cpp 8588]
[Thr 1188] *** ERROR => MsIAttachEx: NiBufConnect to toshiba-user/3601 failed (rc=NIECONN_REFUSED) [msxxi.c 633]
[Thr 1188] *** WARNING => Can't reconnect to message server (toshiba-user/3601) [rc = -100]-> reconnect [jcntrms.c 295]
[Thr 1188] Tue Aug 09 14:42:32 2005
[Thr 1188] *** ERROR => MsIAttachEx: NiBufConnect to toshiba-user/3601 failed (rc=NIECONN_REFUSED) [msxxi.c 633]
[Thr 1188] *** WARNING => Can't reconnect to message server (toshiba-user/3601) [rc = -100]-> reconnect [jcntrms.c 295]
[Thr 1188] Tue Aug 09 14:42:38 2005
[Thr 1188] *** ERROR => MsIAttachEx: NiBufConnect to toshiba-user/3601 failed (rc=NIECONN_REFUSED) [msxxi.c 633]
[Thr 1188] *** WARNING => Can't reconnect to message server (toshiba-user/3601) [rc = -100]-> reconnect [jcntrms.c 295]
[Thr 1188] Tue Aug 09 14:42:44 2005
[Thr 1188] *** ERROR => MsIAttachEx: NiBufConnect to toshiba-user/3601 failed (rc=NIECONN_REFUSED) [msxxi.c 633]
[Thr 1188] *** WARNING => Can't reconnect to message server (toshiba-user/3601) [rc = -100]-> reconnect [jcntrms.c 295]
[Thr 1188] Tue Aug 09 14:42:49 2005
[Thr 1188] JControlMSConnect: reconnected to message server (toshiba-user/3601)
[Thr 1188] Tue Aug 09 14:48:11 2005
[Thr 1188] JControlMSReadMessage: NiPeek() returns -5 NIETIMEOUT
[Thr 1188] Tue Aug 09 14:53:12 2005
[Thr 1188] JControlMSReadMessage: NiPeek() returns -5 NIETIMEOUT
[Thr 1188] Tue Aug 09 14:58:32 2005
[Thr 1188] JControlMSReadMessage: NiPeek() returns -5 NIETIMEOUT
I try to login the visual admin again and gives me the following error: "Cannot open connection on host: 191.9.6.22 and port: 50004"
Looking the log and trace files i see the following errors:
- SAPEngine_System_Thread[impl:5]_5##0#0#Error#1#/System/Server#Plain###Encomi: failed to connect to toshiba-user/3201(Connection refused: connect)#
- java.net.SocketException: socket closed
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:353)
at java.net.ServerSocket.implAccept(ServerSocket.java:448)
at java.net.ServerSocket.accept(ServerSocket.java:419)
at com.sap.engine.core.port.impl0.ServerSocketListener.run(ServerSocketListener.java:87)
- erver socket listener opened by service on socket encountered error. The listener will be stopped.#2#p4#ServerSocket[addr=/0.0.0.0,port=0,localport=50004]
I dont know whats happening, if somebody knows i hope that helps me. Please is urgent.
Thx and Rgds.
GregoryHi, thx a lot both.
Respect the link
http://<hostname>:50<instanceno>00/sap/monitoring/SystemInfo , i cant access it. I cant access by telnet, by visual admin.
In the work folder under \usr\sap\<sid>\JC00 i found that the last updated files are:
- available.txt that contains the following data:
Unavailable 08.08.2005 10:46:53 - 08.08.2005 10:58:54
Available 08.08.2005 10:59:54 - 08.08.2005 13:52:54
Unavailable 08.08.2005 13:53:54 - 08.08.2005 13:53:54
Available 08.08.2005 13:54:54 - 08.08.2005 14:03:54
Unavailable 08.08.2005 14:04:54 - 08.08.2005 14:04:54
Available 08.08.2005 14:05:54 - 08.08.2005 14:34:54
Unavailable 08.08.2005 14:35:54 - 08.08.2005 14:39:44
Unavailable 08.08.2005 14:56:17 - 08.08.2005 16:24:13
Unavailable 08.08.2005 16:28:07 - 08.08.2005 16:29:07
Unavailable 08.08.2005 16:34:36 - 08.08.2005 17:17:58
Unavailable 09.08.2005 08:13:36 - 09.08.2005 08:54:33
Unavailable 09.08.2005 08:57:04 - 09.08.2005 12:46:25
Available 09.08.2005 12:47:25 - 09.08.2005 13:26:25
Available 09.08.2005 13:43:56 - 09.08.2005 13:55:56
Unavailable 09.08.2005 13:56:40 - 09.08.2005 14:04:57
Available 09.08.2005 14:05:57 - 09.08.2005 16:16:57
Unavailable 09.08.2005 16:17:57 - 09.08.2005 17:27:12
Unavailable 10.08.2005 08:10:30 - 10.08.2005 08:35:39
Available 10.08.2005 08:36:39 - 10.08.2005 09:16:39
Available 10.08.2005 12:33:51 - 10.08.2005 14:01:51
- dev_jcontrol that contains the information displayed in the developer trace of jcontrol process(and y mentioned above)
- dev_dispatcher that contains the following info:
[Thr 2664] Wed Aug 10 08:33:04 2005
[Thr 2664] JHVM_RegisterNatives: registering methods in com.sap.bc.proj.jstartup.JStartupFramework
[Thr 2664] JLaunchISetClusterId: set cluster id 5761000
[Thr 2664] JLaunchISetState: change state from [Initial (0)] to [Waiting for start (1)]
[Thr 2664] JLaunchISetState: change state from [Waiting for start (1)] to [Starting (2)]
[Thr 3320] Wed Aug 10 08:33:21 2005
[Thr 3320] JLaunchISetP4Port: set p4 port 50004
[Thr 3528] Wed Aug 10 08:33:26 2005
[Thr 3528] JLaunchISetTelnetPort: set telnet port 50008
[Thr 3528] JLaunchISetTelnetPort: set telnet port 50008
[Thr 3584] Wed Aug 10 08:33:55 2005
[Thr 3584] JLaunchISetHttpPort: set http port 50000
[Thr 2664] Wed Aug 10 08:34:02 2005
[Thr 2664] JLaunchISetState: change state from [Starting (2)] to [Running (3)]
[Thr 2568] Wed Aug 10 08:34:08 2005
[Thr 2568] JHVM_RegisterNatives: registering methods in com.sap.mw.rfc.driver.CpicDriver
[Thr 3660] Wed Aug 10 08:35:07 2005
[Thr 3660] JLaunchISetP4Port: set p4 port 50004
[Thr 3600] Wed Aug 10 08:36:34 2005
[Thr 3600] JLaunchISetHttpPort: set http port 50000
[Thr 3612] Wed Aug 10 12:43:40 2005
[Thr 3612] JLaunchISetHttpPort: set http port 50000
[Thr 3612] JLaunchISetP4Port: set p4 port 50004
[Thr 3612] JLaunchISetTelnetPort: set telnet port 50008
- dev_server0 that contains:
[Thr 2676] Wed Aug 10 08:33:06 2005
[Thr 2676] JHVM_RegisterNatives: registering methods in com.sap.bc.proj.jstartup.JStartupFramework
[Thr 2676] JLaunchISetClusterId: set cluster id 5761050
[Thr 2676] JLaunchISetState: change state from [Initial (0)] to [Waiting for start (1)]
[Thr 2676] JLaunchISetState: change state from [Waiting for start (1)] to [Starting (2)]
[Thr 4296] Wed Aug 10 08:34:58 2005
[Thr 4296] JHVM_RegisterNatives: registering methods in com.sap.mw.rfc.driver.CpicDriver
[Thr 4296] Wed Aug 10 08:35:00 2005
[Thr 4296] JHVM_RegisterNatives: registering methods in com.sap.mw.jco.util.SAPConverters
[Thr 4296] JHVM_RegisterNatives: registering methods in com.sap.mw.jco.util.SAPCharToNUCByteConverter
[Thr 4296] Wed Aug 10 08:35:01 2005
[Thr 4296] JHVM_RegisterNatives: registering methods in com.sap.mw.jco.util.SAPNUCByteToCharConverter
[Thr 2676] Wed Aug 10 08:35:07 2005
[Thr 2676] JLaunchISetState: change state from [Starting (2)] to [Starting applications (10)]
[Thr 208] Wed Aug 10 08:36:34 2005
[Thr 208] JLaunchISetState: change state from [Starting applications (10)] to [Running (3)]
I still dont know whats happening. And i need to solve the problem urgent. I hope u can help me.
Thx and Rgds.
Gregory. -
I´m having trouble with FormsCentral.
My form is running about 8 months with no problems.
Yesterday people started to complain that the system doesn´t accept any date.
That means the date field restricts date entries, from date dd/mm/aaaa (brazilian format) to another dd/mm/aaaa, but every date that users input in, is considered by the system as invalid, even it´s a correct and valid date right between the interval specified!
I need Help Urgent!!!
I depend on these forms to finish the payrol service from here.
Thanks
I´ll be waiting.
Maurício Galletti
Message was edited by: SNOWMAUSS
It look like the system accepts just dates starting from the date of today.
I´m testing.
Please help.
Thanks
Message was edited by: SNOWMAUSS
It looks like the system have some problem just with the date 20/10/2013?!
I´ve fixed the problem change the interval from 20/10/2013 to another date and used 21/10/2013 to another date and it works!
But I think something is wrong with the 20/10/2013 date?!
To reproduce the erros just create a new form with date feature with this exaclty configurations and the bug appears:
I´ll keep waiting
Message was edited by: SNOWMAUSSHi
I´ve concluded that the problem persist if the date interval starts at the
specific date "20/10/2013". Don´t know why?!
Look at the screen capture above, you aks for
Thanks a lot
image: Imagem inline 1
Maurício P. Galletti
Contador
[email protected]
( 55 11 3331-5567
www.cadt.com.br
2013/10/29 Genevieve Laroche <[email protected]>
Re: DATE FIELD PROBLEMS - URGENT created by Genevieve Laroche<http://forums.adobe.com/people/Genevieve+Laroche>in
FormsCentral - View the full discussion<http://forums.adobe.com/message/5797083#5797083 -
Anyone interested in adf swing problems
adf 11g R1 swing problem
I test the new JDEV 11g 11.1.1.1.0 releas Juli 01
I'm using the JClient (Swing) with ADF (BC4J)
and test a simple app
JTable with Combobox don't work:
im set the binding with edit binding in context for JTable
the combobox has a static viewobject with ID and Text (ID 0,1 Text Yes No)
The Table with combobox render OK
but when Click the combobox i see no values in the Combobox
in Previous Release 11.1.1.0.2 work the sample.
It this a Bug in Classe from the bindig Definition file pageDef ????
RTClass="oracle.jbo.uicli.jui.JULOVEditorPropDef"
DTClass="oracle.adfdtinternal.model.ide.objects.jui.JUDTLOVEditorProp"
Hello,
this Bug is not fixed in 11.1.1.2.0
why ????
thank you in advance
Michael
Edited by: user4796211 on 21.07.2009 12:18
Edited by: user4796211 on 22.07.2009 00:59
Edited by: user4796211 on 24.07.2009 09:54
Edited by: user4796211 on 27.07.2009 09:59
Edited by: user4796211 on 16.11.2009 10:56Hi,
I installed JDeveloper 11.1.1.3.0 and cracked the nut. The LOV driven ComboBoxes in JTables will remain empty after migrating to the new version, but it seems to be merely a bug in the migration. What you need to do in order to get the ComboBoxes working is the following:
I found out that in your PageDefs you need to add two attributes to the <combobox> definitions:
ControlClass="javax.swing.JComboBox" Editable="false"
This makes the ComboBoxes look like in previous releases. If you skip the "Editable" attribute, the user can type in values, which does not really work in LOVs but in static lists.
Unfortunately I experienced another bug in the 11.1.1.3.0 release concerning LOVs: When defining the LOV in the ViewDef, JDeveloper wouldn't let you specify any additional columns to be displayed in the LOV ("Display Attributes"). -> The workaround is much easier than I first thought: Just resize the dialog a little bigger and the selection fields that I first missed appear!
In the moment it looks to me like I could continue development with JDeveloper 11.1.1.3.0.
Mathias
Edited by: user7585671 on 05.05.2010 06:26 -
Details:
Hi i can not buy any thing from the app store and any thing from in side any games pls fix my problem urgent and as soon
Note this is second email pls answer and fix my problem
<Email Edited by Host>These are public forums, you are not talking to iTunes Support here (most of the people here, including myself, are fellow users) - I've asked the hosts to remove your email address from your post
If you are getting a message to contact iTunes support then you can do so via this page and ask them why the message is appearing (we won't know why) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption
If it's a different problem ... ? -
Urgent help need on swing problem
Dear friends,
I met a problem and need urgent help from guru here, I am Swing newbie,
I have following code and hope to draw lines between any two components at RUN-TIME, not at design time
Please throw some skeleton code, Thanks so much!!
code:
package com.swing.test;
import java.awt.*;
import java.awt.event.*;
import java.awt.geom.*;
import javax.swing.*;
import javax.swing.event.*;
public class LongguConnectLineCommponent
public static void main(String[] args)
JFrame f = new JFrame("Connecting Lines");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(new ConnectionPanel());
f.setSize(400,300);
f.setLocation(200,200);
f.setVisible(true);
class ConnectionPanel extends JPanel
JLabel label1, label2, label3, label4;
JLabel[] labels;
JLabel selectedLabel;
int cx, cy;
public ConnectionPanel()
setLayout(null);
addLabels();
label1.setBounds( 25, 50, 125, 25);
label2.setBounds(225, 50, 125, 25);
label3.setBounds( 25, 175, 125, 25);
label4.setBounds(225, 175, 125, 25);
determineCenterOfComponents();
ComponentMover mover = new ComponentMover();
addMouseListener(mover);
addMouseMotionListener(mover);
public void paintComponent(Graphics g)
super.paintComponent(g);
Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
Point[] p;
for(int i = 0; i < labels.length; i++)
for(int j = i + 1; j < labels.length; j++)
p = getEndPoints(labels, labels[j]);
//g2.draw(new Line2D.Double(p[0], p[1]));
private Point[] getEndPoints(Component c1, Component c2)
Point
p1 = new Point(),
p2 = new Point();
Rectangle
r1 = c1.getBounds(),
r2 = c2.getBounds();
int direction = r1.outcode(r2.x, r2.y);
switch(direction) // r2 located < direction > of r1
case (Rectangle.OUT_LEFT): // West
p1.x = r1.x;
p1.y = r1.y;
p2.x = r2.x + r2.width;
p2.y = r2.y;
if(r1.y > cy)
p1.y = r1.y + r1.height;
p2.y = r2.y + r2.height;
break;
case (Rectangle.OUT_TOP): // North
p1.x = r1.x;
p1.y = r1.y;
p2.x = r2.x;
p2.y = r2.y + r2.height;
if(r1.x > cx && r2.x > cx)
p1.x = r1.x + r1.width;
p2.x = r2.x + r2.width;
break;
case (Rectangle.OUT_LEFT + Rectangle.OUT_TOP): // NW
p1.x = r1.x;
p1.y = r1.y;
p2.x = r2.x + r2.width;
p2.y = r2.y;
if(r1.y > r2.y + r2.height)
p2.y = r2.y + r2.height;
break;
case (Rectangle.OUT_RIGHT): // East
p1.x = r1.x + r1.width;
p1.y = r1.y;
p2.x = r2.x;
p2.y = r2.y;
if(r1.y > cy)
p1.y = r1.y + r1.height;
p2.y = r2.y + r2.height;
break;
case (Rectangle.OUT_TOP + Rectangle.OUT_RIGHT): // NE
p1.x = r1.x + r1.width;
p1.y = r1.y;
p2.x = r2.x;
p2.y = r2.y;
if(r1.y > cy)
p1.y = r1.y + r1.height;
p2.y = r2.y + r2.height;
if(r1.y > r2.y + r2.height)
p1.y = r1.y;
else
if(r1.y > r2.y + r2.height)
p2.y = r2.y + r2.height;
break;
case (Rectangle.OUT_BOTTOM): // South
p1.x = r1.x;
p1.y = r1.y + r1.height;
p2.x = r2.x;
p2.y = r2.y;
if(r1.x > cx && r2.x > cx)
p1.x = r1.x + r1.width;
p2.x = r2.x + r2.width;
break;
case (Rectangle.OUT_RIGHT + Rectangle.OUT_BOTTOM): // SE
p1.x = r1.x + r1.width;
p1.y = r1.y + r1.height;
p2.x = r2.x;
p2.y = r2.y;
break;
case (Rectangle.OUT_BOTTOM + Rectangle.OUT_LEFT): // SW
p1.x = r1.x;
p1.y = r1.y + r1.height;
p2.x = r2.x;
p2.y = r2.y;
if(r1.x > r2.x + r2.width)
p2.x = r2.x + r2.width;
if(r1.x > cx && r2.x > cx)
p1.x = r1.x + r1.width;
p2.x = r2.x + r2.width;
return new Point[] {p1, p2};
private void determineCenterOfComponents()
int
xMin = Integer.MAX_VALUE,
yMin = Integer.MAX_VALUE,
xMax = 0,
yMax = 0;
for(int i = 0; i < labels.length; i++)
Rectangle r = labels[i].getBounds();
if(r.x < xMin)
xMin = r.x;
if(r.y < yMin)
yMin = r.y;
if(r.x + r.width > xMax)
xMax = r.x + r.width;
if(r.y + r.height > yMax)
yMax = r.y + r.height;
cx = xMin + (xMax - xMin)/2;
cy = yMin + (yMax - yMin)/2;
private class ComponentMover extends MouseInputAdapter
Point offsetP = new Point();
boolean dragging;
public void mousePressed(MouseEvent e)
Point p = e.getPoint();
for(int i = 0; i < labels.length; i++)
Rectangle r = labels[i].getBounds();
if(r.contains(p))
selectedLabel = labels[i];
offsetP.x = p.x - r.x;
offsetP.y = p.y - r.y;
dragging = true;
break;
public void mouseReleased(MouseEvent e)
dragging = false;
public void mouseDragged(MouseEvent e)
if(dragging)
Rectangle r = selectedLabel.getBounds();
r.x = e.getX() - offsetP.x;
r.y = e.getY() - offsetP.y;
selectedLabel.setBounds(r.x, r.y, r.width, r.height);
determineCenterOfComponents();
repaint();
private void addLabels()
label1 = new JLabel("Label 1");
label2 = new JLabel("Label 2");
label3 = new JLabel("Label 3");
label4 = new JLabel("Label 4");
labels = new JLabel[] {
label1, label2, label3, label4
for(int i = 0; i < labels.length; i++)
labels[i].setHorizontalAlignment(SwingConstants.CENTER);
labels[i].setBorder(BorderFactory.createEtchedBorder());
add(labels[i]);If you need some help, be respectful of the forum rules and people will help. By using "urgent" in the title and bumping your message every 2 hours you're just asking to be ignored (which is what you ended up with).
-
HTML Link problem (Urgent!)
I'm writing a prrogram that displays an HTML file. I used a JEditorPane. I tryed using the hyperlinkListener but it doesn't work! here's the class I wrote...
can anyone help please?
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.util.*;
import javax.swing.*;
import browser.*;
import java.net.*;
import javax.swing.event.*;
* Classe :
* Description :
* Societe : Medias France
* @version 1.0
public class Aide extends JFrame implements HyperlinkListener
BrowserInterface bI;
URL url1;
static Interface parent;
public Aide(String titre, Interface i)
super(titre);
parent = i;
getContentPane().setLayout(new BorderLayout());
//bI = new BrowserInterface(jp);
setBounds(10,10,800,600);
addWindowListener(new WindowAdapter()
public void windowClosing(WindowEvent e)
quit(null);
try
url1 = new URL("file:/home/darkazan/java/BDO/tablegen-1.8/help/help.html");
//bI.URL_Process(url1);
catch (MalformedURLException e)
System.out.println("probleme " + e.toString());
JEditorPane editorPane = new JEditorPane();
editorPane.setEditable(false);
try
editorPane.setPage(url1);
catch (IOException e)
System.err.println("Attempted to read a bad URL: " + url1);
JScrollPane editorScrollPane = new JScrollPane(editorPane);
editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
editorScrollPane.setPreferredSize(new Dimension(800, 600));
getContentPane().add(editorScrollPane, "Center");
pack();
setVisible(true);
public void hyperlinkListener(HyperlinkEvent e)
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED)
// do something on HL click
System.out.println("ouverture");
if (e.getEventType() == HyperlinkEvent.EventType.ENTERED)
// do something on mouse over HL
// do something on HL click
System.out.println("bbbbbbbbbbbbbbbbbbbb");
if (e.getEventType() == HyperlinkEvent.EventType.EXITED)
// do something on HL click
System.out.println("ggggggggggggggggggg");
// do something on mouse moved away from HL
public void hyperlinkUpdate(HyperlinkEvent e)
public static void main(String[] args)
Aide aide1 = new Aide("Help", parent);
* Quitter l'application
* @param e L'evenement recu
* @return Sans objet.
void quit(ActionEvent e)
parent.bAide.setEnabled(true);
dispose();
}also check your file protocol it should look like this: file:/// with three slashes(i think?)
here Mr. Urgent, my html viewer: (and it works) ;P
import javax.swing.*;
import javax.swing.event.*;
import javax.swing.text.*;
import javax.accessibility.*;
import java.awt.*;
import java.awt.event.*;
import java.net.URL;
import java.net.MalformedURLException;
import java.io.IOException;
public class iROCHelp extends JPanel implements HyperlinkListener{
//ATTRIBUTES
JEditorPane html;
private static boolean HelpShowing = false;
private static JFrame selTopic;
//METHODS
//Constructor
public iROCHelp(java.net.URL URLstr){
//setBorder(new EmptyBorder());
setLayout(new BorderLayout());
try{
URL url = URLstr;
if(url != null){
html = new JEditorPane(url);
html.setEditable(false);
html.addHyperlinkListener(this);
JScrollPane scroller = new JScrollPane();
JViewport vp = scroller.getViewport();
vp.add(html);
vp.setBackingStoreEnabled(true);
add(scroller, BorderLayout.CENTER);
catch (MalformedURLException e){
System.out.println("Malformed URL: " + e);
catch (IOException e){
System.out.println("IOException: " + e);
}//HelpTopic CONSTRUCTOR
public void hyperlinkUpdate(HyperlinkEvent e){
if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED){
linkActivated(e.getURL());
}//hyperlinkUpdate
protected void linkActivated(URL u){
Cursor c = html.getCursor();
Cursor waitCursor = Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR);
html.setCursor(waitCursor);
SwingUtilities.invokeLater(new PageLoader(u, c));
}//linkActivated
class PageLoader implements Runnable{
PageLoader(URL u, Cursor c){
url = u;
cursor = c;
public void run(){
if (url == null){
// restore the original cursor
html.setCursor(cursor);
Container parent = html.getParent();
parent.repaint();
else{
Document doc = html.getDocument();
try{
html.setPage(url);
catch (IOException ioe){
html.setDocument(doc);
finally{
// schedule the cursor to revert after
// the paint has happended.
url = null;
SwingUtilities.invokeLater(this);
}//else
}//run
URL url;
Cursor cursor;
}//PageLoader
public static void spawnHelp(java.net.URL URLStr){
if (!HelpShowing){
selTopic = new JFrame();
selTopic.getContentPane().setLayout(new BorderLayout());
selTopic.getContentPane().add(new iROCHelp(URLStr),BorderLayout.CENTER);
Dimension dim = selTopic.getToolkit().getScreenSize();
selTopic.setLocation((int)dim.getWidth()/2-selTopic.getWidth()/2,(int)dim.getHeight()/2-selTopic.getHeight()/2);
selTopic.setSize(500, 400);
selTopic.setTitle("Remote Operators Console Help");
selTopic.addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e){
closeHelp();
}//windowClosing
selTopic.show();
HelpShowing = true;
}//if help showing
}//spawnHelp
public static void closeHelp(){
if (HelpShowing){
selTopic.dispose();
HelpShowing = false;
}//closeHelp
}//HelpTopic CLASS -
CardLayout problem, urgent
Hi friends,
I am building a Swing GUI, i have a cardlayout managment, my GUI is dynamic that is every certain period of time new data are coming and new figures are being drawn in my GUI. The GUI containes menus, when you press on any menu list of items are listed for you, when you press on an item a page opens, when you press on another item, a new page opens, those pages are layouted in a cardlayout managment, each page is in top of another. I am getting a problem, when i am opening page 2 for example, and a new set of data comes in and the figure in page 1 is updated, i am automatically moved from page 1 to page 2 where the update happened, although i didn't press the item in the menu to go to that page where the update happened, please would anyone suggest me something, it is very urgent, and if someone wants the code i can supply it for sure, thanks for the help.Maybe an itemStateChanged -Event is invoked when the page is updated.
-
Hi all,
iam getting a problem regarding pricing.
When i make a Sales doc. with reference to an invoice,
everything is being copied from invoice to the sales doc.-customer, material and its no. , sales area, payment terms, incoterms, and material qty. also.
But the pricing of the invoice is not getting copied on to the sales doc.
I have maintained all checks available in the sales doc. type and the item category of the sales doc. type i.e
Pricing: X
and then in OVKK , i have maintained the doc. pric. procedure of the sales doc. type with the pricing procedure of the invoice
and again in the copy control measures, i have maintained
Pricing type: D
But i still not able to copy pricing procedure from the invoice to the Sales doc.
I want the soltn. urgently.
Thanks in advance
Souravrun VTAF for your sales doc type/bil type
and check item category
set flag for "update doc flow"
and pricing type B -
1.4.2 Java Swing problems
I have a swing application with 2 JComboBox 's, 1 JPanel (for pictures), 1 JButton and a scroll pane. Basicall the JComboBoxes have an action listener that changes the pictures when I cahnge the names. However, I would like the Jbutton when pressed to display the name chosen (from the JComboBox) and display it in the textArea. See code below.
import javax.swing.*;
import javax.swing.Action;
import java.awt.event.ActionEvent;
import java.awt.event.ItemListener;
import java.awt.*;
import java.awt.event.*;
* @author Administrator
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
public class choice_in2 extends JPanel implements ActionListener{
private JLabel contender1FieldLabel;
private JLabel contender2FieldLabel;
private JButton runButton;
JLabel picture1;
JLabel picture2;
//Text area which shows the result
private JTextArea textArea;
private JLabel textAreaLabel;
public choice_in2(){
// Create a ChoiceField for the input of first contender
contender1FieldLabel = new JLabel("Contender1 ",4);
String[] contender1Strings = { "Bill", "Bob", "Don", "Michael", "John" };
JComboBox contender1List = new JComboBox(contender1Strings);
contender1List.setSelectedIndex(1);
contender1List.addActionListener(new Eavesdropper1(picture1));
// Create a ChoiceField for the input of second contender
contender2FieldLabel = new JLabel("Contender2 ",4);
String[] contender2Strings = { "Philip", "Timothy", "Tom", "Kenneth", "Stone" };
JComboBox contender2List = new JComboBox(contender2Strings);
contender2List.setSelectedIndex(2);
contender2List.addActionListener(new Eavesdropper2(picture2));
//Set up the first picture.
picture1 = new JLabel();
picture1.setFont(picture1.getFont().deriveFont(Font.ITALIC));
picture1.setHorizontalAlignment(JLabel.CENTER);
updateLabel1(contender1Strings[contender1List.getSelectedIndex()]);
picture1.setBorder(BorderFactory.createEmptyBorder(10,0,0,0));
//Set up the second picture.
picture2 = new JLabel();
picture2.setFont(picture1.getFont().deriveFont(Font.ITALIC));
picture2.setHorizontalAlignment(JLabel.CENTER);
updateLabel2(contender2Strings[contender2List.getSelectedIndex()]);
picture2.setBorder(BorderFactory.createEmptyBorder(10,0,0,0));
//The preferred size is hard-coded to be the width of the
//widest image and the height of the tallest image + the border.
//A real program would compute this.
picture1.setPreferredSize(new Dimension(200, 220+10));
picture2.setPreferredSize(new Dimension(200, 220+10));
// Create a JButton that will compute
runButton = new JButton("Compute");
runButton.addActionListener(new Eavesdropper3(textArea));
// Create a JTextArea that will display the results
textAreaLabel = new JLabel("Results");
textArea = new JTextArea(10,70);
textArea.setFont(new Font("Courier",Font.PLAIN,12));
JScrollPane scrollPane = new JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
textArea.setEditable(false);
//Lay out the demo.
add(contender1List, BorderLayout.WEST);
add(picture1, BorderLayout.WEST);
add(contender2List, BorderLayout.EAST);
add(picture2, BorderLayout.EAST);
add(runButton, BorderLayout.EAST);
add(textAreaLabel, BorderLayout.SOUTH);
add(scrollPane, BorderLayout.SOUTH);
setBorder(BorderFactory.createEmptyBorder(20,20,20,20));
/** Listens to the combo box. */
public void actionPerformed(ActionEvent e) {
public void updateLabel1(String name1) {
ImageIcon icon1 = createImageIcon( name1 + ".jpg");
picture1.setIcon(icon1);
picture1.setToolTipText("A drawing of a " + name1.toLowerCase());
if (icon1 != null) {
picture1.setText(null);
} else {
picture1.setText("Image not found");
public void updateLabel2(String name2) {
ImageIcon icon2 = createImageIcon( name2 + ".jpg");
picture2.setIcon(icon2);
picture2.setToolTipText("A drawing of a " + name2.toLowerCase());
if (icon2 != null) {
picture2.setText(null);
} else {
picture2.setText("Image not found");
/** Returns an ImageIcon, or null if the path was invalid. */
public ImageIcon createImageIcon(String path) {
java.net.URL imgURL = choice_in2.class.getResource(path);
if (imgURL != null) {
return new ImageIcon(imgURL);
} else {
System.err.println("Couldn't find file: " + path);
return null;
class Eavesdropper2 implements ActionListener {
JLabel myTextArea;
public Eavesdropper2(JLabel ta) {
myTextArea = ta;
public void actionPerformed(ActionEvent e) {
JComboBox contender2List = (JComboBox)e.getSource();
String contender2ListName = (String)contender2List.getSelectedItem();
updateLabel2(contender2ListName);
Eavesdropper3 code;
code = new Eavesdropper3(contender2ListName);
class Eavesdropper1 implements ActionListener {
JLabel myTextArea;
public Eavesdropper1(JLabel tt) {
myTextArea = tt;
public void actionPerformed(ActionEvent e) {
JComboBox contender1List = (JComboBox)e.getSource();
String contender1ListName = (String)contender1List.getSelectedItem();
updateLabel1(contender1ListName);
class Eavesdropper3 implements ActionListener {
String contender22;
JTextArea myTextArea;
public Eavesdropper3(JTextArea bb) {
myTextArea = bb;
public Eavesdropper3(String contender2ListName){
contender22 = contender2ListName;
* @return Returns the contender22.
public String getContender22() {
return contender22;
public void actionPerformed(ActionEvent e) {
textArea.setText("Wild Test");
textArea.append("\n OUTCOME \n\n " +getContender22());
}weebib
We are using Windows XP , Nvidia graphics card, with Multiview. I hope the problem is not specific to the platform.
It is reproducible with 1.4.2 and absent in 1.4.1
camickr
I am new to this forum. didn't know about code blocks. -
Output problem urgent!!
Okay so heres the problem i have a piece of code to convert a decimal value that a user enters into a binary value. My algorithm works its just when the binary value is displayed only the last element of the binary value to be outputed is displayed. But i want all the values of the binary number to be displayed. I dont know what to do plz help.
the code i am using is:
import java.awt.*;
import java.awt.event.*;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import javax.swing.*;
public class conversion extends JPanel implements ActionListener
JPanel board; // Panel for buttons
JLabel canvas; // Text Area for displaying answer
JButton convert, reset; // buttons
JTextField input; //input text box
public conversion()
super(true); // Call constructor of parent
// Standard layout (flow)
setLayout(new FlowLayout());
// Set up two panels, control board and canvas
board = new JPanel(true);
canvas = new JLabel();
board.setPreferredSize(new Dimension(100, 100));
canvas.setPreferredSize(new Dimension(300, 300));
board.setBorder(BorderFactory.createLineBorder(Color.black));
canvas.setBorder(BorderFactory.createLineBorder(Color.blue));
// Create buttons and attach listeners
convert = new JButton("Convert");
convert.addActionListener(this);
reset = new JButton("Reset");
reset.addActionListener(this);
input = new JTextField(8);
add(canvas); add(board);
// Add button to board panel
board.add(convert);
board.add(input);
board.add(reset);
public void actionPerformed(ActionEvent e)
String inputInfo;
inputInfo = input.getText();
if (e.getSource() == convert){ //action on convert button
//algorithm for decimal to binary conversion
int a = Integer.parseInt(inputInfo); //Gets decimal number inputed
if (a > 255){
canvas.setText("Please enter a number below 256");
else {
int b[] = new int[50];
int i = 0;
if (a / 2!=0 || a==1) //Checks to see if decimal number is divisible by 2
{ //Or exactly equal to 1
while(a!= 1) //While loop for when the decimal inputted is not equal to 1
b= a % 2;
a = a / 2; //Check to see if the remainder is divisible by 2
i++;
b[i]= 1;
for(int x=i;x>=0;x--)
//Displays the binary answer
int answer = b[x];
String stringAns = Integer.toString(b[x]);
System.out.println(stringAns);
canvas.setText ("The binary for your decimal is: " + stringAns); // this is the problem here, only the last element is displayed
if (e.getSource() == reset){ //action on reset button
canvas.setText("");
input.setText("");
//Graphics g = canvas.getGraphics();}
public static void main(String[] args)
// Create a Blob entity
conversion b = new conversion();
// Set up outer frame, and its exit behaviour
JFrame frame = new JFrame("Decimal to binary");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
// Set the main content frame to be the Blob,
// size the frame (pack) and make it visible
frame.setContentPane(b);
frame.pack();
frame.setVisible(true);pauze wrote:
for(int x=i;x>=0;x--)
//Displays the binary answer
int answer = b[x];
String stringAns = Integer.toString(b[x]);
System.out.println(stringAns);
canvas.setText ("The binary for your decimal is: " + stringAns); // this is the problem here, only the last element is displayed
Each element in the array b contains one digit of the binary representation. You need to convert each digit into a character and then concatenate all the characters into a String before displaying anything. -
Media reconnection problem URGENT!
I am in a very urgent situation.
Working on a feature length project and today after opening 2 sequences I was working on yesterday I had to relink media, because my scratch disks were not connected.
While relinking, final cut pop up says that some clips' media start & end has changed , continue with relinking or cancel. I had to continue work so I went on. Alas, now i am in front of a nightmare!
Both sequencies have been altered. In some areas the edits look the same but the content is different, in other areas cuts have been totaly removed.
please help.Thank you for trying to help. These file were imported by log and capture and were atomaticaly converted to prores 422 LT. I did not mess around with file names, as the names were given during the log and transfer proccess.
This is definetely a final cut bug.
The problem dissapeared (not solved though, as the reasons remain unknown) with the folowing way:
a) I open one of the backed up files and looked at my rough cut wich consists of sequencies.
b) By playing the 2 specific sequencies on the rough cut, there was no error in the edit.
c) By opening these 2 sequencies on the project browser, there was a different edit !!!!
d) By going back to the rough cut and double clicking on the nested sequence, I could see the original edit.
e) Now I had one specific sequence in the timeline, the same name, the identical sequence, opened in two different tabs. In one tab (the sequence that i entered to through the rough cut) the edit was the original, in the other tab (the one that i opened through the project browser) the edit was distorted !!!
f) I copied the clips of the original edit to a newly created sequence.
g) I deleted the old- problematic sequence
h) i repeated the process with the second sequence that was altered by final cut on its own will.
I hope this will help someone in a similar situation and I keep this question as unsolved, because in reality noone really knows - until now- the reason for this situation. Thank god it was solved. -
MSI 6368 with USB problem (URGENT)
I have an urgent need to solve this problem.
Client has a computer based on this motherboard, with Celeron 1.1 Ghz, WIN 98 Second Edition.
The USB port works with a Microsoft mouse. Client tries to install a Canon digital camera (D60), but the USB port cannot see the camera.
Is there something I should be doing?
Thanks a lottry a different cable? Not sure about Canon but they might need a program that they supply with the camera to move the files off of the camera. Sort of like MP3 players and how they ship with their own proprietary software to move files onto the player and etc.
Maybe you are looking for
-
ERROR 7 (Windows error 193) How to install iTunes today?
Unable to install newest iTunes version, after using it for 3-4 years. Error message indicates that "Service 'Apple Mobile Device' failed to start. Verify you have sufficient privileges to start system services." All info on iphone up to date.
-
I received a pdf file that is upside down. Rotated and saved. When I open the file, it is still upsided. How to solve this problem?
-
The computer that I set up Adobe Standard XI crashed and I need to reinstall all my software on my new computer. I have a product key for adobe XI standard, but when I go to download XI standard I keep getting redirected to Adobe XI pro. Unfortaunate
-
Solaris libraries and C apis for disk information
i want to know which C APIs and libraries are used to get information about disk vendor,serial no etc.(similar to what we get using iostat -En)
-
If I upgrade my iphone, can the older iphone still work like an ipod and use wifi?
Thinking about going from a 4S to a 5S. Can I use my 4S like an iPod Touch on wifi without cellular data?