Editing string from a JTextBox
hallo.
I'm trying to make a simple text editing program. You input a sentence, and a method changes some words to others:
For example, you put in this sentence: "Patty is not a tool"
And this comes out: "Patty is totally a tool"
The edited sentence will appear in JLabel fixed.
Here's the code:
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Sentence extends JFrame implements KeyListener {
JTextField text = new JTextField(10);
public String text2 = text.getText();
public String sent1 = "";
JLabel label = new JLabel("Type a sentence so that I can fix it for you.");
JLabel fixed = new JLabel("--");
Sentence() {
super("Sentence Correcter");
setSize(350,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBackground( Color.black );
text.addKeyListener(this);
FlowLayout flo = new FlowLayout();
setLayout(flo);
add(label);
add(text);
add(fixed);
setVisible(true);
public void keyTyped(KeyEvent in) {
fixSentence(text2);
System.out.println(""+text2);
public void keyPressed(KeyEvent na) {
public void keyReleased(KeyEvent na) {
public void fixSentence(String sent) {
fixed.setText(""+sent);
String a = "a";
String b = "b";
sent.replaceAll(a, b);
fixed.setText(""+sent);
System.out.println(""+sent);
public static void main(String[] args) {
Sentence s = new Sentence();
}that changes all "a" to "b". Doesn't work of course. What am i missing?
Edited by: pattyisalive on Mar 23, 2008 9:34 PM
Edited by: pattyisalive on Mar 23, 2008 9:35 PM
Sorry, i'm not sure if bumping is aloud, but my problem still exists. Here's what I have now for code:
import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
public class Sentence extends JFrame implements KeyListener {
JTextField text = new JTextField(10);
public String text2 = "";
public String[] realWords = {"the", "and"};
public String[] newWords = {"teh", "adn"};
JLabel label = new JLabel("Type a sentence so that I can fix it for you.");
JLabel fixed = new JLabel("");
Sentence() {
super("Sentence Correcter");
setSize(350,100);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
text.addKeyListener(this);
FlowLayout flo = new FlowLayout();
setLayout(flo);
add(label);
add(text);
add(fixed);
setVisible(true);
public void keyTyped(KeyEvent in) {
public void keyPressed(KeyEvent in) {
int key = in.getKeyCode();
if (key == KeyEvent.VK_ENTER) {
text2 = text.getText();
fixSentence(text2);
public void keyReleased(KeyEvent na) {
public void fixSentence(String sent) {
for(int i = 0; i < realWords.length; i++) {
sent.replaceAll(realWords, newWords[i]);
sent.trim();
fixed.setText(sent);
public static void main(String[] args) {
Sentence s = new Sentence();
} Now it outputs exactly what i type in the JTextBox, after I hit the ENTER key. It still doesn't replace the realWords with newWords, and I can't figure out why.
Similar Messages
-
Is it possible to pass a string from an applet to the web site?
Hi, everybody!
Is it possible to pass a String from an applet to a web site (as a field value in a form, an ASP variable, or anything else). Basically, I have a pretty large String that is being edited by an applet. When a user clicks on the submit button, a different page will show up which has to display the modified string. The String is pretty large so it doesn't fit into the URL variable.
Please, help!
Thank you so much!Why do you want to do this in Java?
Javascript is the correct language for these type of situations.
for instance:
in the head of your html document:
<script language=javascript type="text/javascript">
createWindow(form){
if(form.text.value!=""){
newDoc = new document
newDoc.write(form.text.value)
newWin = window.open(document,'newWin','width=200;height=150')
</script>
in the body:
<form onSubmit="createWindow(this)">
<p>
Enter a String:<input type=text size=30 name="text">
</p><p>
<input type=submit value="submit">
<input type=reset value="reset">
</p>
</form> -
Convert String from UTF-8 to IsoLatin1
Hi everyone !
I'm trying to convert a String from utf-8 to IsoLatin1, but i got somt problems.... I'm using
actually this code, but it won't work...
I'm getting a utf-8 html String with some data and i will write it down in latin1 to a text file
String newString = new String(oldString.getBytes("UTF-8"), "ISO-8859-1");If i'm now writing this newString to a TextFile it contains cryptic signs like
& # 1 3 ; or & # 1 3 7 ; or & # 1 2 8 ;(i separated this chars)
can anyone tell me where is my fault and how can i solve this problem ?
Thanks a lot
Edited by: Sephiknight on Feb 23, 2008 2:41 AMYes its XML, i got a web editor where i can add input (utf-8) and i want to write it down in my class to a xml file (isoLatin1).
My code looks likte this
public static void setEditFragment(String content, String xPath) throws Exception {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse("3001300.xml");
XPath xpath = XPathFactory.newInstance().newXPath();
Node node = (Node)xpath.evaluate(xPath, document, XPathConstants.NODE);
Charset charset = Charset.forName("ISO-8859-1");
CharsetEncoder encoder = charset.newEncoder();
ByteBuffer buf = encoder.encode(CharBuffer.wrap(content));
node.setTextContent(buf.toString());
// Use a XSLT transformer for writing the new XML file
Transformer transformer = TransformerFactory.newInstance().newTransformer();
DOMSource source = new DOMSource( document );
FileOutputStream os = new FileOutputStream("tmp.xml");
StreamResult result = new StreamResult( os );
transformer.transform( source, result );
}The example from http://www.exampledepot.com/egs/java.nio.charset/ConvertChar.html looks great, but if I add my own input string i get a exception that looks like this
java.nio.charset.UnmappableCharacterException: Input length = 1
at java.nio.charset.CoderResult.throwException(Unknown Source)
at java.nio.charset.CharsetEncoder.encode(Unknown Source)
at HagerAbs.setEditFragment(HagerAbs.java:91)
at HagerAbs.main(HagerAbs.java:108)When i write my input to the xml file it doesnt look like xml at all, it looks more like
<synthese>& # 13;
& # 13;
& lt;br/& gt;& # 13;
& lt;img class="thumb" src="http: ......{code}
(i seperated the char so you can see)
and this is not what i expected... how can i write it down correctly ?
Edited by: Sephiknight on Feb 23, 2008 3:26 AM -
How to search a string from the database?
how to search a string from the database? starting with some character
If you're trying to do this in a SELECT, you can use the LIKE verb in your WHERE clause.
Here's an Example
SELECT obj_name FROM tadir
INTO prog
WHERE pgmid = 'R3TR'
AND object = 'PROG'
AND obj_name LIKE 'Z%'.
In this case it will select every row that obj_name starts with Z.
If you wanted to find every row that the field obj_name contains say... 'WIN' you use LIKE '%WIN%'.
Edited by: Paul Chapman on Apr 22, 2008 12:32 PM -
I AM TRYING TO IMPORT CHARACTERS FROM A TAB DELIMITED FILE INTO A TABLE ON LABVIEW. ONCE THE DATA IS IN THE TABLE I WANT TO BE ABLE TO SELECT INDIVIDUAL STRINGS FROM THE TABLE AND PLACE IT IN A NEW TABLE. WHEN I CLICK ON A STRING I WOULD LIKE THE SELECTED STRING TO SHOW IN A TEXT BOX LABELED 'SELECTED STEP' AFTER ALL THE SELECTED STRINGS IS IN THE TABLE I WOULD LIKE TO SAVE THE NEW TABLE AS ANOTHER SPREADSHEET -- TAB DELIMITED -- FILE, MAKING IT ACCESSIBLE TO OPEN. HERE IS WHAT I HAVE SO FAR. I CAN INPUT DATA INTO THE TABLE, BUT I CAN ONLY TRANSFER ONE STRING INTO THE TABLE I WOULD LIKE TO BE TO INPUT MULTIPLE STRINGS. ALSO WHENEVER I TRY SAVING THE FILE, IT ALWAYS SAVES A UNKNOWN FILE, HOW CAN I GET IT TO SAVE AS A SPREADSHEET FILE. THANKING ALL OF YOU IN ADVANCE FOR YOUR HELP!!!!!!
Attachments:
Selector.zip 30 KBPondered,
The question you are asking is the same one that you asked in: http://forums.ni.com/ni/board/message?board.id=170&message.id=132508#M132508, to which I supplied a revised version of the original vi you used (which was modified from the original one I supplied to an earlier thread). A couple of questions: 1) What does my latest not do that is in your question, 2) Why are you starting yet another thread about the same problem? We are here trying to help, it makes it a lot easier if you keep the same problem in the same thread, it reduces duplication of effort from those that might not have been following the previous thread(s). Those of us that don't have our "names in blue" are just doing this "for fun" (the blue names are NI employees, who may still be doing it "for fun"), and it makes it more fun if it doesn't seem (correctly or not) that our attempts are ignored. If an answer doesn't help, or seems incomplete, post a little more detail to the same thread so that the original respondent, or someone new, can provide more information, or understand your problem better.
P.M.
Message Edited by LV_Pro on 07-20-2005 01:20 PM
Putnam
Certified LabVIEW Developer
Senior Test Engineer
Currently using LV 6.1-LabVIEW 2012, RT8.5
LabVIEW Champion -
Hello i need a help about script to export translatable text strings from ai files and import them back after editing, thanks in advance
Lanny -
Thank you for taking the time to help with this problem. Can I just say however that as someone who has posted a first comment here and quite clearly never used a forum like this before, your comment unfortunately comes across as very excluding. It makes me feel there are a set of unwritten rules that I should know, and that I don't know them shows that the forum is not for me. In short, it's exactly the kind of response that stops people like me using forums like this.
I'm sure it's not intended to be received like this and I am sure that the way you have responded is quite normal in the rules of a forum like this. However, it is not normal for those of us who aren't familiar with forums and who only encounter them when they have a genuine problem. This is why I hope it is helpful to respond in full.
The reason I posted here is as follows. I was directed here by the apple support website. The original comment seemed to be the only one I could find which referred to my issue. As there is no obvious guidance on how to post on a forum like this it seemed perfectly reasonable to try and join in a conversation which might solve more than one problem at once.
Bee's reply however is both helpful and warm. This could in fact be a template for how new members should be welcomed and inducted into the rules of the forum in a friendly and inclusive way. Thank you very much indeed Bee! -
Premiere Pro CS4 - editing video from GoPro video camera
I am having a problem trying to edit video from the GoPro camera in Premiere Pro CS4 (PP). Have not been able to get much help from GoPro - they just tell me to speak with Adobe. I think the video codec used by the camera is MJPEG (?). It won't play at all on the timeline. Interestingly it will in After Effects (AE) CS4 and if I export it out of AE as a Microsoft AVI file I can then play it in PP. However if I go straight to Media Encoder and import the clip and then try export the clip via ME as a Microsoft AVI the exported clip from ME won't play in Premiere Pro. I am confused. Does anyone know this camera, it's codec and why it just won't work when directly imported into Premiere Pro but it will when imported directly into After Effects. Any advise would be greatly appreciated.
Please see a post I made this morning under my screen name BruceERoberts .... details below
I just purchase Adobe Premiere Pro a few days ago - and subsequently updated it to Ver 4.2.1. A started a new project - I tried to import some video footage I just shot with a GOPro Hemet Cam while skiing at our local mountain. I can easlily see the clip using Real Media Player - or the Quick Time player. It is a 10.9 MB ... 7 second MPEG-4 movie clip. File name is "gopro0030.mp4"
I created a "bin" called video .... then right clicked to import the file. You can see the file name in the media browser. But the file would not import. I received this error message: "109C ImporterProcessServer.exe Application Error. The instruction at "0x05efcac" referenced memory at "0x00000014". The memory could not be read. CLick OK to terminate."
This is very frustrating - I just purchased the software - and it won't import a 7 second video clip! It did import still fotos with no problem. What can I do?
thank you for your attention to this.
Bruce Roberts, Vernon B.C.
March 14th 2010
System Info
MS Windows XP
Version 2002 SP3
Dell Dimension XPS
Pentium 4 CPU 3.4 Ghs
3.39 Ghz 3.00 GB of RAM -
How can I get the edited pictures from the thumbnails to full size?
I upgraded to iPhoto 11, the thumbnail photos show my previous edits, but when I click on the photo to make it bigger, it reverts back to the unedited, original picture. How can I get the edited pictures from the thumbnails to full size?
Verify you are using iPhoto11 ver 9.5
if not run the >Software update or check your apps folder and make sure the correct iPhoto is launched, not an older ver. -
Returning strings from OLE2 Word object (Forms 4.5)
Below is an example of how to return string and numeric values from OLE2 objects. In this example the OLE2 object is a MS Word document, and I want to fetch all the bookmarks in the Document into a Forms 4.5 Varchar2. To do this I first need to get the count of bookmarks.
Getting a string property from an OLE2 object is a common OLE2 requirement but is poorly documented. This is the ONLY way it can be done, as OLE2.INVOKE_CHAR returns a single character not a string. Use OLE2.INVOKE_OBJ, then OLE2.GET_CHAR_PROPERTY which does return a string, as shown below, to return a string from an OLE object (or OLE property).
Also note how you can only get the child object from its parent, not the grandchild (etc) object, so multiple (cascading) GET_OBJ_PROPERTY calls are required.
/* by: Marcus Anderson (Anderson Digital) (MarcusAnderson.info) */
/* name: Get_Bookmarks */
/* desc: Returns a double quoted CSV string containing the document*/
/* bookmarks. CSV string will always contain a trailing comma*/
/* EG: "Bookmark1","Bookmark2",Bookmark3",Bookmark4", */
/* NB: This requires that Bookmarks cannot contain " chr */
PROCEDURE Get_Bookmarks (pout_text OUT VARCHAR2)
IS
v_text VARCHAR2(80);
v_num NUMBER(3);
v_arglist OLE2.LIST_TYPE;
v_Application OLE2.OBJ_TYPE;
v_ActiveDoc OLE2.OBJ_TYPE;
v_Bookmarks OLE2.OBJ_TYPE;
v_Item OLE2.OBJ_TYPE;
v_i NUMBER(3);
BEGIN
v_Application := LDWord.MyApplication; -- Word doc opened elsewhere
/* Set v_num = ActiveDocument.Bookmarks.Count */
v_ActiveDoc := OLE2.GET_OBJ_PROPERTY (v_Application, 'ActiveDocument');
v_Bookmarks := OLE2.GET_OBJ_PROPERTY (v_ActiveDoc , 'Bookmarks');
v_num := OLE2.GET_NUM_PROPERTY (v_Bookmarks, 'Count'); -- NB: Returns numeric property
/* Build the output string, pout_text. */
FOR v_i in 1..v_num LOOP
/* Set v_item = ActiveDocument.Bookmarks.Item(v_i) */
v_arglist := OLE2.CREATE_ARGLIST;
OLE2.ADD_ARG (v_arglist, v_i);
v_Item := OLE2.INVOKE_OBJ (v_Bookmarks, 'Item', v_arglist); -- NB: returns parent object (array element)
OLE2.DESTROY_ARGLIST (v_arglist);
/* Set v_text = ActiveDocument.Bookmarks.Item(v_i).Name */
v_text := OLE2.GET_CHAR_PROPERTY (v_Item, 'Name'); -- NB: Returns string/varchar2 property
pout_text := pout_text || '"' || v_text || '",' ;
END LOOP;
END;Please repost in the Forms discussion forum.
- OTN -
We are in the middle of testing our R12 Upgrade. I am getting this error from the invoice XML-based report that we are using in R12. (based on log). Only for a specific invoice number that this error is appearing. The trace is not showing me anything. I don't know how to proceed on how to debug where the error is coming from and how to fix this. I found a patch 8339196 that shows exactly the same error number but however, I have to reproduce the error in another test instance before we apply the patch. I created exactly the same order and interface to AR and it doesnt generate an error. I even copied the order and interface to AR and it doesn't complete with error. It is only for this particular invoice that is having an issue and I need to get the root cause as to why. Please help. I appreciate what you all can contribute to identify and fix our issue. We have not faced this issue in R11i that we are maintaining right now for the same program which has been running for sometime. However, after the upgrade for this particular data that the user has created, it is throwing this error REP-271504897.
MSG-00100: DEBUG: Get_Country_Description Return value:
MSG-00100: DEBUG: Get_Country_Description Return value:
REP-0002: Unable to retrieve a string from the Report Builder message file.
REP-271504897:
REP-0069: Internal error
REP-57054: In-process job terminated:Terminated with error:
REP-271504897: MSG-00100: DEBUG: BeforeReport_Trigger +
MSG-00100: DEBUG: AfterParam_Procs.Populate_Printing_Option
MSG-00100: DEBUG: AfterParam_Procs.Populate_Tax_Printing_Option
MSG-00100: DEBUG: BeforeReport_Trigger.Get_Message_Details
MSG-00100: DEBUG: BeforeReport_Trigger.Get_Org_Profile.
MSG-00100: DEBUG: Organization Id: 117
MSG-00100: DEBUG: BeforeReport_Trigger.Build_Where_Clause
MSG-00100: DEBUG: P_Choi
Report Builder: Release 10.1.2.3.0 - Production on Tue Jul 23 09:56:46 2013
Copyright (c) 1982, 2005, Oracle. All rights reserved.Hi,
Check on this note also : Purchasing Reports Fail When Changing Output To XML REP-0002 REP-271504897 REP-57054 (Doc ID 1452608.1)
If you cant reproduce the issue on other instance, apply the patch on the test instance and verify all the funcionality related to the patch works OK. Then move the patch to production. Or you can clone the prod environment to test the patch.
Regards, -
How to remove Editable region from nested template?
I'm trying to remove an editable region from a nested
template while retaining it in the parent template. DW doesn't want
to let me do this.
Example:
- I've created an overall template call ALLPAGES.DWT
- In it, there's an editable region called "related links".
- The "related links" will stay the same for all my main
pages (welcome, news, info, etc), so I'd like to create a nested
template called MAINPAGES.DWT where the field is locked.
So here's what I did; I started a new page from ALLPAGES.DWT
and then I created a template MAINPAGES.DWT from it. Now I want to
remove the editable region "related links". According to the DW
manual, I should be able to highlight the region and go to
Modify > Templates > Remove Template Markup, but that
option is greyed out!
Apparenlty the only way of removing the editable region is to
create a smaller editable region within it. But that's unnecessary
and sloppy. How can I remove the region entirely?> This use of nested templates is very useful and very
simple and
> straightforward.
> It involves no additional overheads, and introduces no
reliability
> problems.
I really disagree with this.
> I cannot understand why Murray has such a bad attitude
to nested
> templates.
I spent quite a bit of time using them, tweaking them,
understanding them,
and watching the problems that others have had here on the
forum. My
compelling conclusion is that there is nothing you can do
with nested
templates that you cannot do more simply and with far less
trouble by using
other methods, some involving other kinds of template
regions, and some
involving simple use of Library items, or better, server-side
includes.
> I can only assume either that he had a bad experience on
the road to
> Damascus,
> after writing his definitive book on templates
I assure you, it's based on much more study and experience
than you have put
into it.
> "Templates are wicked and sinful! Don't play with them,
or you will go
> blind!"
This is not only unkind, it's completely erroneous. Far and
away, I am the
single most enthusiastic proponent for the use of templates
on these boards.
Perhaps a read of my book would help you rid yourself of your
attitude, too.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"Clancy" <[email protected]> wrote in message
news:[email protected]...
> "Dodgeit" <[email protected]> wrote:
>
>>I'm trying to remove an editable region from a nested
template while
>>retaining
>>it in the parent template. DW doesn't want to let me
do this.
>>
>> Example:
>> - I've created an overall template call ALLPAGES.DWT
>> - In it, there's an editable region called "related
links".
>> - The "related links" will stay the same for all my
main pages (welcome,
>> news,
>>info, etc), so I'd like to create a nested template
called MAINPAGES.DWT
>>where
>>the field is locked.
>
> Very simple:
>
> Open allpages.dwt.
> Save as template, with name mainpages.dwt (I always do
this immediately so
> that
> if I do something stupid I don't corrupt the original
template).
> Insert the desired content into "related links".
> At the beginning of the content area of "related links"
insert the magic
> code
> @@("")@@
> This turns off the editable region, and there will be no
reference to it
> in
> pages derived from this template.
> Save the changes to mainpages.dwt
> Done!
>
> Have a look at
>
>
http://www.corybas.com/Technical/Nested.htm
> This is derived from my template techpage.dwt, which in
turn is ultimately
> derived from my template basicpage.dwt.
>
> Basicpage.dwt defines two editable regions 'title' and
'subtitle' at the
> top of
> the page. Techpage.dwt sets a fixed title for all my
technical pages, as
> follows:
>
> <p class="hdgtn" ><!-- InstanceBeginEditable
name="Title" -->@@("")@@Roger
> Riordan: Technical notes<!-- InstanceEndEditable
--></p>
> <p class="hdgstn"><!-- InstanceBeginEditable
name="Subtitle" -->Notes<!--
> InstanceEndEditable --></p>
>
> In the page Nested.htm the references to 'title'
disappear, and the two
> lines
> appear as
>
> <p class="hdgtn" >Roger Riordan: Technical
notes</p>
> <p class="hdgstn"><!-- InstanceBeginEditable
name="Subtitle" -->Nested
> Templates<!-- InstanceEndEditable --></p>
>
> This use of nested templates is very useful and very
simple and
> straightforward.
> It involves no additional overheads, and introduces no
reliability
> problems.
>
> I cannot understand why Murray has such a bad attitude
to nested
> templates. I
> can only assume either that he had a bad experience on
the road to
> Damascus,
> after writing his definitive book on templates, or that
it says simply:
>
> "Templates are wicked and sinful! Don't play with them,
or you will go
> blind!"
>
>
> Clancy -
REP-0002: Unable to retrieve a string from the Report Builder message file;
Hi,
I've a custom report in which i need to display a large string, of more than 4000 characters. To cater to this requirement i've written a formula column which displays string upto 4k characters and for a string of size beyond 4k i am calling a procedure which uses a temp table having a clob field.
For a small string the report runs fine but whenever a large string requirement comes into the picture, said procedure gets triggered and i get REP-0002: Unable to retrieve a string from the Report Builder message file.
OPP log for the same gives an output as under:
Output type: PDF
[9/21/10 2:17:12 PM] [UNEXPECTED] [388056:RT14415347] java.io.FileNotFoundException: /app/soft/test1udp/appsoft/inst/apps/e180r_erptest01/logs/appl/conc/out/o14415347.out (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at oracle.apps.fnd.cp.opp.XMLPublisherProcessor.process(XMLPublisherProcessor.java:241)
at oracle.apps.fnd.cp.opp.OPPRequestThread.run(OPPRequestThread.java:172)
Report Builder 10g
BI Publisher's version : 4.5.0
RDBMS Version : 10.2.0.4.0
Oracle Applications Version : 12.0.6
Searched for the same on metalink and found Article ID 862644.1, other than applying patch and upgrading version of BI Publisher is there any other workaround to display a comma seperated string as long as 60k characters, If any please suggest.
Thanks,
BhoomikaMetalink <Note:1076529.6> extracts
Problem Description
When running a *.REP generated report file you get errors:
REP-00002 Unable to retrieve string from message file
REP-01439 Cannot compile program since this is a runtime report
Running the same report using the *.RDF file is successful.
You are running the report with a stored procedure,
OR you are running against an Oracle instance other than the one developed on,
Or, you recently upgraded your Oracle Server.
Solution Description
1) Check that the user running the report has execute permissions on any stored
SQL procedures called. <Note:1049458.6>
2) Run the report as an .RDF not an .REP , that is remove or rename the .REP
version of the report. <Note:1012546.7>
3) Compile the report against the same instance it is being run against.
<Note:1071209.6> and <Note:1049620.6> -
Reading Each String From a text File
Hello everyone...,
I've a doubt in File...cos am not aware of File.....Could anyone
plz tell me how do i read each String from a text file and store those Strings in each File...For example if a file contains "Java Tchnology forums, File handling in Java"...
The output should be like this... Each file should contains each String....i.e..., Java-File1,Technology-File2...and so on....Plz anyone help meThe Java� Tutorials > Essential Classes: Basic I/O
-
How to look at a query string from Nav Bar Find Mode
I would like to view the resultant query string from the Navigavtion Bar's Find Mode. I am using a Master/Detail and am querying with the selection criteria from the detail only.
I am getting unexpected results, and would just like to SEE what the query string IS.
ThanksI am getting unexpected results, and would just like to SEE what the query string IS.Run your app with diagnostic output turned on. Here's the instructions for that.
To turn on diagnostic, go to the IDE,
1. Select the project.
2. Do right mouse click and select "Project Settings..."
3. On the Settings dialog, select Configurations/Runner.
4. In the righthand side pane, you should see a textbox for "Java
Options". Please add the following JVM switch:
-Djbo.debugoutput=console
Then, rerun. The run command should include
-Djbo.debugoutput=console as in
"D:\JDev9i\jdk\bin\javaw.exe" -Djbo.debugoutput=console -classpath ...
You should now see a lot more output on the IDE's message window.
This should also include the findmode query that gets built after you hit the execute button from a findmode panel. -
How to put a string from one Frame to another Frame?
Dear all,
How can I put a String from one Frame to another Frame?
When the application started, the Frame 'WindowX' will be displayed. After you press the 'openButton', a whole new Frame (inputFrame) will be shown. In this Frame )(inputFrame) you can write a String in a TextField. After pressing the okButton, this String will be sent to the first Frame 'WindowX'.
But does anyone know how to realize the sending part?
I've tested this code on Win98 SE and JDK1.2.2.
Hope someone can help me. Thanks in advance.
import java.awt.*;
import java.awt.event.*;
public class WindowX extends Frame implements ActionListener, WindowListener
private Button openButton;
private TextField resultField;
public static void main(String [] args)
WindowX wx = new WindowX();
wx.setSize(300,100);
wx.setVisible(true);
public WindowX()
setLayout(new FlowLayout());
openButton=new Button("open");
add(openButton);
openButton.addActionListener(this);
resultField=new TextField(10);
add(resultField);
resultField.addActionListener(this);
addWindowListener(this);
public void actionPerformed(ActionEvent evt)
if (evt.getSource()==openButton)
inputFrame ip=new inputFrame();
ip.setSize(200,80);
ip.show();
public void place(String theString) //this doesn't work
resultField.setText(theString);
public void windowClosing(WindowEvent event)
System.exit(0);
public void windowIconi......
class inputFrame extends Frame implements ActionListener,WindowListener
String theString = "";
Button okButton;
TextField inputField;
WindowX myWX=new WindowX(); //??
public inputFrame()
setLayout(new FlowLayout());
inputField=new TextField(10);
add(inputField);
inputField.addActionListener(this);
okButton=new Button("OK");
add(okButton);
okButton.addActionListener(this);
addWindowListener(this);
public static void main(String[] args)
Frame f = new Frame();
f.show();
public void actionPerformed(ActionEvent evt)
if (evt.getSource()==okButton)
theString=inputField.getText();
myWX.place(theString); //??
dispose();
public void windowClosing(WindowEvent e) {
dispose();
public void windowIconi......
}Thanks for your reply!
But I got an other problem:
I can't refer to the object (wx) made from the main Frame 'WindowX', because it's initialized in 'public static void main(String [] args)'...
Hope you can help me again... Thanks!
import java.awt.*;
import java.awt.event.*;
public class WindowX extends Frame implements ActionListener, WindowListener
private Button openButton;
private TextField resultField;
public static void main(String [] args)
WindowX wx = new WindowX(); //!!
wx.setSize(300,100);
wx.setVisible(true);
public WindowX()
setLayout(new FlowLayout());
openButton=new Button("open");
add(openButton);
openButton.addActionListener(this);
resultField=new TextField(10);
add(resultField);
resultField.addActionListener(this);
addWindowListener(this);
public void actionPerformed(ActionEvent evt)
if (evt.getSource()==openButton)
inputFrame ip=new inputFrame(wx);
ip.setSize(200,80);
ip.show();
public void place(String theString)
resultField.setText(theString);
public void windowClosing(WindowEvent event)
System.exit(0);
public void windowIconi....
class inputFrame extends Frame implements ActionListener,WindowListener
String theString = "";
Button okButton;
TextField inputField;
WindowX parent;
public inputFrame(WindowX parent)
setLayout(new FlowLayout());
this.parent=parent;
inputField=new TextField(10);
add(inputField);
inputField.addActionListener(this);
okButton=new Button("OK");
add(okButton);
okButton.addActionListener(this);
addWindowListener(this);
public static void main(String[] args)
Frame f = new Frame();
f.show();
public void actionPerformed(ActionEvent evt)
if (evt.getSource()==okButton)
theString=inputField.getText();
parent.place(theString);
dispose();
public void windowClosing(WindowEvent e) {
dispose();
public void windowIconi..........
}
Maybe you are looking for
-
Never before had a problem with iTunes 10.1.1 seeing my iPhone. Recently updated my 10.5.8 system to 10.6.6 by installing it over the 10.5.8 system. Everything went well until I discovered that iTunes 10.1.1 wouldn't recognize my iPhone when I connec
-
DAG Concept not working in my Exchange 2010
Hi , Exchange 2010 In my setup two mailbox servers and 2 servers with HUB and CAS role. One of my mailbox servers got down and DAG not works , and also noticed all database dismounted including the other mailbox server Databases. When Mailbox ser
-
I have a mini with a superdrive. There was a CD in the drive and the drive ejected it. Since then it will not accept any discs. The discs don't go in the drive all the way. The usual function, in which the drive "grabs" the disc and pulls it in, is n
-
How to get today date in mm/dd/yyyy
How do i get today date in mm/dd/yyyy format ? Thanks Michael
-
I'm currently using Illustrator with a Wacom Cintiq 22hd which is great fun, but there is one annoying thing which I was wondering if there is a fix to that I'm missing. When tracing and wanting to pick up paths or anchors, the little green text tha