Help with selecting complete words in text field. Add Icons to Text Field
Hi,
I am creating GUI for a Email program. The user can send emails, send files as attachment.
When the user selects his files to attach I am displaying them as a string in a TextField along with there size
The user can attach files with the help of FileChooser dialog invoked on click of a JButton
e.g. file1.txt(5K), file2.txt(10K)
Now whenever user wants to delete one of the files I want him to delete the entire file name with its size.
So that I get the correct string of file names to send to the smtp server.
Any one got clues how I can restrict the user to delete the complete name of the file.
I think if I could make the user to select entire names, and restrict him from moving in the textfield character by character it would be possible. But not sure how to exactly achieve that
Also I would like to display the Icon along with the file names in the TextField any ideas how it can be done.
I get the Icon from the File dialog but don't know how to show it up in the TextField
The safest way to handle this is using a JList. But it is possible to do this with the JTextArea. For selecting the entire file, put an action listener on the JTextArea. If someone clicks ona word, it will highlight, by using setSelectionStart(int) and setSelectionEnd(int) found in JTextComponent. Use 0, the length, and the index of the commas for the points to start and end selection. As far as the images, I know it can be done (smileys in chat messages for example) but I've never seen the code to do it. It may just override the paint method and paint in an ImageIcon at the specified location.
Similar Messages
-
Help with creating a form, I want to add a check box to enable me to unlock certain fields and deselect the block again
Look to the right under "More Like This". Your issue has been discussed many many times. The error you are seeing is because you do not have enough free "contiguous" space on your hard drive. Read the other threads that address this issue to find how to solve the issue.
Or, put "The disk cannot be partitioned because some files cannot be moved" into the search box at the upper right of this page. -
Help with SELECT - selecting range of numbers
Hi,
I need a help with SELECT statement. I want to select Dates starting from today and ending 30 days back. So the result would be like:
TRUNC(SYSDATE)
TRUNC(SYSDATE) - 1
TRUNC(SYSDATE) - 2
TRUNC(SYSDATE) - 3
TRUNC(SYSDATE) - 30I was thinking to simply select truncated SYSDATE in first column, and in second column numbers 0, 1, 2, ... 30. Then I would simply do a difference first column - second column. But how to select such sequence of numbers? I don't want to select each number (date) in separate select statement and then unioning them.
Does anybody have an idea?
Thanks for help, DanSQL> select trunc(sysdate) - level + 1 as dt
2 from dual
3 connect by level <= 31
4 ;
DT
07/01/2013
06/01/2013
05/01/2013
04/01/2013
03/01/2013
02/01/2013
01/01/2013
31/12/2012
30/12/2012
29/12/2012
28/12/2012
27/12/2012
26/12/2012
25/12/2012
24/12/2012
23/12/2012
22/12/2012
21/12/2012
20/12/2012
19/12/2012
DT
18/12/2012
17/12/2012
16/12/2012
15/12/2012
14/12/2012
13/12/2012
12/12/2012
11/12/2012
10/12/2012
09/12/2012
08/12/2012
31 rows selected -
Need help with almost completed plugin engine project
Hi all,
For a while now I have been working on a plugin engine. After a few iterations, the engine is similar to the Eclipse engine, in that plugins use extension points and extensions to allow contributions. Unlike the eclipse engine I have added the ability for plugins to fire events through the engine and other plugins can add listeners, all through the plugin.xml manifest. Dependencies are mostly handled automatically at plugin load time (when extensions get resolved to extension points, and listeners get resolved to events). For the case where a plugin needs to use classes from another plugin, dependencies are also allowed to be declared. Like the eclipse engine, activation of plugins occurs the first time a class is used within the plugin's classpath, OR a plugin can be activated after it is loaded.
What I need help with is testing, working on examples to provide with the engine project, and feedback/suggestions before we release the M1 build. I am asking for those that are interested in this type of work to volunteer to help where applicable and possible. I want to provide a solid plugin engine to the java community, one that is easy to use, works well, and is pretty effecient in terms of resource usage and performance.
Of particular interest to me right at the moment is dealing with multiple versions. As I see it, the engine will be used within an application and as such plugins would be distributed with a specific application version. The plugin version itself is more of a notification as to what version a plugin is, although I imagine it will help when updating at runtime as well.
Just a few other details of the engine. It handles (or will soon) dynamic load, unload and reload of plugins at runtime. Plugins can be distributed in an archive file format, we call .par (Plugin ARchive), with additional plugin filename extensions configurable at runtime. The plugins can be developed and deployed in an expanded directory format as they are in Eclipse as well, or in the archive format. In the archive format they do not need to be unzipped when deployed, and they can contain embeded jar/zip libraries. The engine handles finding and creating classes directly out of the .par file at runtime.
Multiple locations to find plugins are configurable before the engine starts, and even after it starts more could be added to allow additional locations to find plugins. URLs are supported, and soon the HTTP protocol will be supported so that plugins can be downloaded and installed at runtime.
The project can be found at www.sourceforge.net/projects/genpluginengine. If you would like to get involved and help out, please sign up on the dev mail list and send an email to introduce yourself to the rest of the members on the list.
I'll also add that I am working on a Swing UI Framework built entirely from plugins. It provides a ready-to-launce UI application that developers can simply add their plugins to, extending various extension points of the framework to have menu items, toolbar buttons, status bar access, help and preferences dialog additions, file i/o choosers, tons of open-source components ready to use (or extend to add on to), and like Eclipse, hopefully... draggable window frames that can be dropped on any other frame to form a tabbed frame of windows. Some of this is a ways off, some is getting there now. Presently you can add menu items that do allow plugin activation when first clicked, so plugins can be loaded but not activated until needed. The Preference dialog works but is not completed, and a plugin that adds a plugin control panel to view all loaded plugins, activate them, load/unload/reload, view extension points, extensions, dependencies, etc is partially completed. The point is, to allow a ready to run UI framework in Swing with an easy path for developers to quickly build applications with. If you are interested in this, when you join the mail list and introduce yourself, indicate that you are interested in this as well, as we need help with plugin development for it and would appreciate more help here too.
Look forward to some replies.Might I suggest setting up a project at a known project-site? I've seen your progress and questions posted here from time to time, but one of the drawbacks is that you have to fill each post with the entirity of your vision to explain what you're doing. That's a lot of text to read - and most folks will skip right over it.
On the other hand, a well-crafted, good-looking project web-site, with appropriate links and docs and vision statements, diagrams, etc. will have more likelyhood of attracting volunteers. java.net and sourceforge.net are likely spots to set up shop. In addition, you get CVS and bug-tracking systems, which can be quite valuable in such a large-scale project where there are lots of pieces. -
Hi
Any one help me please below is the html I have. its reading
a .js file from an external source. The problem is word wrapping
the content I need to make the conten wrap with in this table as i
have no control of how the external content is constructed.
Any help please.
<table width="100%" border="0" cellpadding="0"
cellspacing="0" id="PARA2">
<tr>
<td><script language="JavaScript"
type="text/javascript" src="
http://www.domain.net/p2.js"></script></td>
</tr>
</table>anyone not help with this please
-
pLEASE HELP WITH CONVERTING A PDF REPORT TO A WORD DOC WHERE i CAN MAKE CHANGES AND PRINT A NEW REPORT.
Hi Christine,
It looks like you have a subscription to our ExportPDF service. Follow the steps in our Getting Started Guide to convert your PDF to Word: http://forums.adobe.com/docs/DOC-2412
You should be able to edit your file in Word after the conversion.
-David -
Out of the blue, am unable to open Word attachments in Mail with the usual double click. (Get a longwinded error message)
Need to right click, select open with, and select Microsoft Word. Have been using Microsoft Office for Mac 08 for years.
I have reinstalled the Office software. A couple of tech people have been unable to fix it. Any suggestion?? debsuemyPlease re-post in the Office for Mac Product Forums .
-
Help with selecting chuncks of data from a table
Hi all,
I need help with a query that should do the following.
I have a table with vessel messages, and I need to get the last "NumMsgs" messages from a group of vessels.
The problem I have is that if I order the table by Vessel_ID, MessageDate DESC, I can´t do ROWNUM < NumMsgs (<-- Then number of messages to be shown is a user parameter)
I know it should be something like:
select * from (
select *
from Messages m
where TRIM(m.V_ID) = '11597' /* I was trying for a single vessel atm */
order by m.V_ID, m.MESSAGEDATE desc
where rownum < :NumMsgs
Any ideas?
Thanks in advance !Hi,
What about :
select *
from (
select m.*, row_number() (order by m.V_ID, m.MESSAGEDATE desc) rn
from Messages m
where TRIM(m.V_ID) = '11597' /* I was trying for a single vessel atm */
where rn < :NumMsgsAnyway, I don't very well understand your problem, your query work fine, see for example :
SQL> ed
Wrote file afiedt.buf
1 select object_name, object_id
2 from
3 (select object_name, object_id, row_number() over (order by object_id desc) as rn
4 from dba_objects)
5* where rn < 4
SQL> /
PS_TL_MTCHD_118 71763
PS_TL_MTCHD_117 71762
PS_TL_MTCHD_116 71761
SQL> ed
Wrote file afiedt.buf
1 select object_name, object_id
2 from
3 (select object_name, object_id
4 from dba_objects
5 order by object_id desc)
6* where rownum < 4
SQL> /
PS_TL_MTCHD_118 71763
PS_TL_MTCHD_117 71762
PS_TL_MTCHD_116 71761
SQL> Nicolas.
Message was edited by:
N. Gasparotto -
Need a help with select in the servlet
i have:
<form action=../servlet/Test name=test method=get>
<input type=submit value=submit />
<select size=3 name=ret>
<option value=1>abrakadabra1 </option>
<option value=2>abrakadabra2 </option>
<option value=3>abrakadabra3 </option>
</select>
</form>
in the servlet i
print(request.getParameter("ret"));
and got i [object].
How can i get all value from <select name=ret> in the servlet?
Thankshtml
<html>
<head>
<script>
var store = new Array();
store[0] = new Array(
'labas11',
'labas12',
'labas13');
store[1] = new Array(
'labas21',
'labas22',
'labas23');
// Funkcija skirta dedant naujienu
// irasa formuoti sarasa kuriems vartotojams bus siunciama zinute
function populate()
var box = document.forms[0].first;
var number = box.options[box.selectedIndex].value;
if (!number) return;
var list = store[box.selectedIndex];
if (list.length==null) return;
var box2 = document.forms[0].second;
box2.options.length = 0;
for(i=0;i<list.length;i++)
box2.options[i] = new Option(list,list[i]);
function addGroup()
var box = document.forms[0].first;
var number = box.selectedIndex;
if (number>-1)
document.forms[0].third.options[document.forms[0].third.options.length]=new Option('[G] '+box.value,document.forms[0].third);
function addUser()
var box = document.forms[0].second;
var number = box.selectedIndex;
if (number>-1)
document.forms[0].third.options[document.forms[0].third.options.length]=new Option('[V] '+box.value,document.forms[0].third);
function removeOne()
var box = document.forms[0].third;
var number = box.selectedIndex;
if (number>-1)
box.remove(box.selectedIndex);
function removeAll()
// alert(document.forms[0].third.options[0].text);
var box = document.forms[0].third;
box.options.length=0;
function selectToList()
//this code selects all the elements in the select field
for(var i=0;i<document.forms[0].third.length;i++)
document.forms[0].third.options[i].selected=true;
alert(document.forms[0].third.options[i].text);
</script>
</head>
<body>
<form action='servlet/List' method=Post>
<select size=4 name="first" style="width:200px" onchange="populate()">
<option value="0">html</option>
<option value="1">css</option>
</select>
<select size=4 name="second" style="width:200px">
</select>
<select size=4 name="third" style="width:200px" multiple>
</select>
<input type=submit value=spausk onClick="selectToList();" />
</form>
<table>
<tr><td><button onclick="addGroup()"> Įdėti grupę </button></td></tr>
<tr><td><button onclick="addUser()"> Įdėti vartotoją</button></td></tr>
<tr><td><button onclick="removeOne()"> �alinti </button></td></tr>
<tr><td><button onclick="removeAll()"> I�valyti </button></td></tr>
</table>
</body>
</html>
servlet
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class List extends HttpServlet
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{ doAction(request,response);}
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{ doAction(request,response);}
public void doAction(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
response.setContentType("text/html;charset=windows-1257");
PrintWriter out = response.getWriter();
String[] strArray=request.getParameterValues("third");
out.print("Value: "+strArray[0]);
Why i cant get a correct parameter value
Thanks -
Need help with select that month range with flexible first date
Hello everyone,
I am trying to create a selection of month range (will be in a WITH clause) for a report to display monthly data. But the first month start date can be any date. (Not necessarily the first date of the month)
Examples:
Report input parameters:
Start Date: 08/10/12
End Month: Dec 2012
I was trying to build a with select that will list
Month_Start, Month_End
08/10/12, 31/10/12
01/11/12, 30/11/12
01/12/12, 31/12/12
OR
Month_Start, Next_Month
08/10/12, 01/11/12
01/11/12, 01/12/12
01/12/12, 01/01/13
End month is optional, so if no value the select will list only
08/10/12, 01/11/12
Oracle Database Details is
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
My code so far is
VARIABLE P50_START_DATE VARCHAR2 (10)
VARIABLE P50_END_MONTH VARCHAR2 (10)
EXEC :P50_START_DATE := '10/10/2012';
EXEC :P50_END_MONTH := '31/12/2012';
SELECT to_char(:P50_START_DATE) AS start_date
, ADD_MONTHS( TRUNC(to_date(:P50_START_DATE,'DD/MM/YYYY'),'MONTH'), 1) AS next_month
FROM dual
union
SELECT to_char(ADD_MONTHS( TRUNC(to_date(:P50_START_DATE,'DD/MM/YYYY'),'MONTH'), ROWNUM-1)) AS start_date
, ADD_MONTHS( TRUNC(to_date(:P50_START_DATE,'DD/MM/YYYY'),'MONTH'), ROWNUM) AS next_month
--, rownum
from all_objects
where
rownum <= months_between(to_date(NVL(:P50_END_MONTH, :P50_START_DATE),'DD/MM/YYYY'), add_months(to_date(:P50_START_DATE,'DD/MM/YYYY'), -1))
and rownum > 1If I put comment – on line and rownum > 1, as
-- and rownum > 1The result I get is
START_DATE NEXT_MONTH
01/10/12 01/10/12
01/11/12 01/11/12
01/12/12 01/01/13
10/10/2012 01/11/12 But when I try to remove the duplicate period (of the first month) out by restrict rownum, it do not return any rows for the second select at all. The result I get is:
START_DATE NEXT_MONTH
10/10/2012 01/11/12 Can anyone advise what wrong with the select statement ?
Thanks a lot in advance,
AnnHi,
Here's one way:
WITH params AS
SELECT TO_DATE (:p50_start_date, 'DD/MM/YYYY') AS start_date
, TO_DATE (:p50_end_month, 'DD/MM/YYYY') AS end_date
FROM dual
SELECT GREATEST ( start_date
, ADD_MONTHS ( TRUNC (start_date, 'MONTH')
, LEVEL - 1
) AS month_start
, LEAST ( end_date
, ADD_MONTHS ( TRUNC (start_date, 'MONTH')
, LEVEL
) - 1
) AS month_end
FROM params
CONNECT BY LEVEL <= 1 + MONTHS_BETWEEN ( end_date
, TRUNC (start_date, 'MONTH')
;:p50_end_month doesn't have to be the last day of the month; any day will work.
If you want to generate a Counter Table containing the integers 1 througn x in SQL, you could say
SELECT ROWNUM AS n
FROM all_objects
WHERE ROWNUM <= x
;but, starting in Oracle 9.1, it's much faster to say
SELECT LEVEL AS n
FROM dual -- or any table containing exactly 1 row
CONNECT BY LEVEL <= x
;Also, x can be greater than the number of rows in all_objects. -
Is it possible to add icons to a field in the table control ?
Dear Gurus,
Greetings..............
Is it possible to add icons to the line item of a field in the table control ?
Thanks in advance
Raj KumarHI
YES IT IS POSSIBLE.
DO THE FOLLOWING
1.DECLARE INCLUDE <ICON>.
2.IN YOUR INTERNAL TABLE DECLARE FIELD ICON
icon(4) TYPE c,
3. POPULATE YOUR INTERNAL TABLE WITH APPROPRIATE ICONS BY SELECTING FROM INCLUDE SPECIFIED ABOVE.
EG:
wa2-icon = '@5C@'.
4.PASS IT TO FIELDCAT
wa_fieldcat-fieldname = 'ICON'.
wa_fieldcat-icon = 'X'. " Displayed as Icon
wa_fieldcat-tabname = ' '.
wa_fieldcat-seltext = 'Status'.
wa_fieldcat-coltext = text-001.
APPEND wa_fieldcat TO it_fieldcat. -
Help with a ramdom word selection
Hello everyone.
I'm trying to write a ramdom word program using a arraylist.
I'm NOT a student, I'm doing this as a fun project and to learn how to use ramdom method..
code is below.
class WordClass1 {
private String wd_id;
private String word_name;
public WordClass1(String id) {
wd_id = id;
public WordClass1(String id, String Wd) {
this.wd_id = id;
this.word_name = Wd;
// accessors
public String getWd_id() {return wd_id;}
public String getWord() {return word_name;}
public String toString() {
return "(" + wd_id + word_name + ")";
}//close class Person class
public class HangmanWords {
static ArrayList<WordClass1> arlist;
static Scanner kbd;
public static WordClass1 makePerson() {
WordClass1 temp = null;
// prompt for data
String id;
String Wd;
System.out.print("Enter ID Number ==>");
id = kbd.next();
System.out.print("Enter Last Name ==>");
Wd = kbd.next();
// make an object
temp = new WordClass1(id, Wd);
return temp;
public static void main(String[] args) {
// make array list object
List < WordClass1 > arlist = new ArrayList < WordClass1 > ();
arlist.add(new WordClass1("A1", "STRING"));
arlist.add(new WordClass1("A2", "PERSON"));
arlist.add(new WordClass1("B1", "CLASS"));
arlist.add(new WordClass1("B2", "JAVA"));
System.out.println(arlist);
// make a scanner
kbd = new Scanner(System.in);
int choice;
System.out.println("Make a Section: ");
System.out.println("1. Enter Word ");
System.out.println("2. Get the word ");
System.out.println("3. Exit this Program ");
System.out.print("\nPlease press Enter afer each response");
System.out.println("\nEnter your choose please: ");
choice = kbd.nextInt();
kbd.nextLine();
if (choice == 1) { // if 1 is select
}// close while loop
if (choice == 2) { // if 2 is select go to find
int randomIndex = Math.abs(((Iterator<String>) arlist).next()getWord.length());
if (choice == 3) {
System.out.printf("Good bye");
}// close the choice == 3
// print out all elements of array list
for (WordClass1 idx : arlist) {
System.out.printf("Employee here are the list of all Employees Empoyeed");
System.out.printf("Employee Id is %s%n", idx.getWd_id());
System.out.printf("Name is %s %s%n", idx.getWord());
System.out.println("--------------------");
}//close for loop
}//close main
}//close public classmy problem lies here in which I'm trying to get the word selected.
int randomIndex = Math.abs(((Iterator<String>) arlist).next()getWord.length());Any help would be great.
PS this code is for a hangman game.
nomadA couple of suggestions:
1) You've got a nice WordClass1. Good to see some OOP going on. Why not do the same for HangmanWords class? Why not change the arraylist from a static variable to an instance variable? You can initialize it in the constructor. You then could create a third class: HangmanDriver that has your main. Think encapsulation.
2) arlist I hate to say it is a terrible name for a variable. It tells you what kind of data structure the data is in, something that could easily change in the future, but doesn't tell anything about what kind of data is contained in it. It would be better to call it something else, perhaps hangmanWords or wordList or somesuch thing.
3) try to encapsulate your user interface (I/O) routines into their own class. If you really get this program going, you're going to want to translate it from console to Swing GUI. Why not build it from the ground up in a way that would make this transition easy.
Here's one way the HangmanWords could look:
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
* encapsulates my hangman word list
* If I make this class implement the Iterable
* interface, I can loop through it more readily.
* @author petes1234
public class HangmanWords implements Iterable<WordClass1>
private List<WordClass1> wordList;
private Random rand;
public HangmanWords()
wordList = new ArrayList<WordClass1>();
rand = new Random();
public boolean add(WordClass1 word)
return wordList.add(word);
public boolean remove(WordClass1 word)
return wordList.remove(word);
public WordClass1 get(int i)
return wordList.get(i);
public WordClass1 getRandom()
int randomIndex = rand.nextInt(wordList.size());
return get(randomIndex);
// this is all we need to implement the Iterable interface
public Iterator<WordClass1> iterator()
return wordList.iterator();
} -
Help with SELECT to get a total from a database field? ASP/VBScript
I have two tables, Events and Orders. The Events table:
eventID
title
ticketsavailable
The Orders table:
orderID
customerID
eventID
numberofticketspurchased
I want to be able to calculate the total number of tickets
purchased by all
customers.
I'd managed to vind out the total number of orders, for any
one event, by
doing the following:
(SELECT COUNT(*) FROM dbo.orders WHERE dbo.events.eventID =
dbo.orders.eventID) AS numberoforders
...I wondered if there was something similar, to give me the
total number of
tickets purchased? Thanks.
Regards
Nathontradmusic.com wrote:
> "Dooza" <[email protected]> wrote in message
> news:[email protected]...
>> tradmusic.com wrote:
>>> "Dooza" <[email protected]> wrote in
message
>>> news:[email protected]...
>>>> tradmusic.com wrote:
>>>>> Also, this will only return events that
have sold tickets right?
>>>>> Ideally I'd like to show all events, but
I guess if they are linked by
>>>>> eventID, I'm kinda stuck?
>>>> What exactly do you want the output to look
like?
>>>>
>>>> Steve
>>> I wanted to view a list of all of the events,
with a column that showed
>>> the number of tickets left.
>>>
>>> In my events table, I have a "tickets available"
column, which is the
>>> original stock number. In my output, I basically
wanted to perform a
>>> calculation that would subtract the SUM column
value from the tickets
>>> available column, giving me the number of
tickets left in stock.
>>>
>>> Thanks again.
>>> Nathon.
>> Ok, so you want:
>>
>> 1. Event
>> 2. Tickets Sold (SUM)
>> 3. Tickets Available
>> 4. Tickets Remaining
>>
>> Grouped by Event.
>>
>> SELECT dbo.events.eventtitle,
SUM(dbo.webordersitems.ticketquantity)
>> AS ticketsSold, dbo.events.ticketsavailable,
>> (dbo.events.ticketsavailable -
(SUM(dbo.webordersitems.ticketquantity)))
>> AS ticketsRemaining
>> FROM dbo.events JOIN dbo.webordersitems ON
dbo.events.bookeventID =
>> dbo.webordersitems.bookeventID
>> GROUP BY dbo.events.eventtitle
>>
>> Steve
>
> Thanks Steve, that's really helpful.
> This is still only going to show events that have had a
sale though, right?
>
> I guess I could just create two recordsets on my page,
one for events that
> have had sales, and one for the remaining events.
> My understanding is that, because we are running a JOIN
by bookeventID, it
> wouldn't actually be possible to display all events
because, by the very
> nature of the statement, the bookeventID has to appear
in the webordersitems
> table, indicating that a sale had taken place.
>
> Much appreciated. Thanks again.
Hi Nathan, I think its the combination of the JOIN and the
GROUP BY
which is preventing you from getting exactly what you want.
If you look
up JOINS you will find one called an OUTER JOIN, that will
help, but due
to the GROUP BY it will fail, so I think for the moment your
best bet is
2 recordsets.
Steve -
Hello, Oracle community. I'm a new developer fresh out of school and I'm working on an issue tracker project on Apex 2.1. I have a page where we create cases that involve various issues called in by our clients through our support center. This app is supposed to replace what the support center currently has.
My main problem is functionality. I have several select lists that redirect to the case creation page. I have conditions that allow several hidden fields to appear when certain values are chosen. We also have a couple of text areas for details and resolutions. The problem is that when we enter data into the text areas (CASE_DETAIL and CASE_RES) and escalate the case to a higher tier of support via redirecting select list, all text that was typed is cleared away when it redirects back to the page. All other select list values remain because they've already been redirected. How do I keep my text fields populated while preserving my select lists? The text areas are set to "Only when current..."
If there's any links that you guys can provide with detailed info on how to handle these types or problems (the documentation is a bit general) I'd greatly appreciate it. I'm still learning this stuff. :)
DennisWow, thanks.
We had tried this before, but since we had email shooting off to our clients whenever the page was submitted, we went with the redirect. My brother (we're both working on this project) found the following topic while looking for this one:
Select list with Redirect => other page items are reseted
We had used the process to only send email when the CREATE button was pressed but completely missed the fact that we could do the same with the process row. The solution now is to switch all select lists to submit and make the process row conditional to only fire when the CREATE button is pressed. Now the page submits as much as it wants to, the text fields stay populated, and we don't get redundant emails and entries into the CASE table.
Thanks for the help. I hope to return the favor some day. :) -
Help with select code??
I have a calendar program in jsp. The users can enter description for the dates. These dates are stored in the database. I need to provide colors to those dates,which have a value 'N' in the weekender field. Am able to write the query, but am not able to provide the color. how can i do it? please help..
<%@ page import="java.util.List"%>
<%@page import="java.sql.*, java.util.*, java.text.*" %>
<%@page import="java.sql.Connection, java.sql.DriverManager,java.sql.ResultSet,java.sql.SQLException" %>
<html>
<head>
<title>Print a month page.</title>
<meta name="version">
<script>
var lastId = "";
var curId = "";
function selectDate(f)
if(document.forms[0].lastDateId != null)
lastId = document.forms[0].lastDateId.value;
if(lastId != document.forms[0].todayId.value)
if(document.getElementById(lastId).title == "")
document.getElementById(lastId).style.backgroundColor='white';
if(f.id != document.forms[0].todayId.value)
document.getElementById(f.id).style.backgroundColor='blue';
document.forms[0].lastDateId.value=f.id;
curId = f.id;
document.getElementById("descr").style.visibility='visible';
document.forms[0].descText.value = f.title;
function setTitle()
document.getElementById(curId).title=document.forms[0].descText.value;
if(document.forms[0].descText.value == "" && curId != document.forms[0].todayId.value)
document.getElementById(curId).style.backgroundColor='white';
else
if(document.forms[0].list.value == "" )
document.forms[0].list.value = curId+":"+document.getElementById(curId).title;
else
list = replaceList(document.forms[0].list.value,curId);
list = list+","+curId+":"+document.getElementById(curId).title;
document.forms[0].list.value = list;
document.getElementById("descr").style.visibility='hidden';
function replaceList(list,id)
arr = list.split(",");
newlist = "";
for(i in arr)
if(arr.match(id) == null)
if(newlist == "")
newlist = arr[i];
else
newlist += ","+arr[i]+",";
return newlist
function showCalendar()
location.href="CalendarPage.jsp?year="+document.forms[0].year.value;
</script>
</head>
<body bgcolor="#c6d9e4">
<%
Connection con = null;
response.setContentType("text/html");
try
String driverName = "com.mysql.jdbc.Driver";
Class.forName(driverName);
String serverName = "192.168.10.5";
String mydatabase = "Trainees";
String url = "jdbc:mysql://" + serverName + "/" + mydatabase;
String username = "venkat";
String password = "venkat";
con = DriverManager.getConnection(url, username, password);
Statement stmt = null;
ResultSet rset = null;
PreparedStatement PREPstmt1;
stmt = con.createStatement();
String year = request.getParameter("year");
out.println("year value is : "+year);
String date="",descr="";
String list = request.getParameter("list");
if(list != null)
String dateDescrList[] = list.split(",");
for(int i=0;i<dateDescrList.length;i++)
String listObj = dateDescrList[i];
if(!listObj.equals("") || !listObj.trim().equals(""))
date= year+"-"+listObj.substring(0,listObj.indexOf(":"));
descr = listObj.substring(listObj.indexOf(":")+1);
out.println("date is : "+date);
out.println("description is : "+descr);
String query = "insert into Holiday(HolidayDate, Description, Weekender) VALUES (?, ?, 'N')";
PREPstmt1=con.prepareStatement(query);
PREPstmt1.setString(1,date);
PREPstmt1.setString(2,descr);
PREPstmt1.executeUpdate();
catch(Exception e)
System.err.println("Exception: " + e.getMessage());
finally
try
if(con != null)
con.close();
catch(SQLException e)
%>
<%
Calendar c = Calendar.getInstance( );
boolean yyok = false;
int yy = 0, mm = 0;
String yyString = String.valueOf(c.get(Calendar.YEAR)); //setting calendar with current year
String STyear = request.getParameter("year"); //to get selected year
if(STyear != null) //If an year is selected, then set that year. Else Current Year
yyString=STyear;
if (yyString != null && yyString.length() > 0)
try
yy = Integer.parseInt(yyString);
yyok = true;
catch (NumberFormatException e)
out.println("Year " + yyString + " invalid");
if (!yyok)yy = c.get(Calendar.YEAR);
mm = c.get(Calendar.MONTH);
String todayId = "";
%>
<form method=get action="CalendarPage.jsp">
Enter Year : <select name="year">
<%
for(int i=2000;i<=2015;i++)
if(i==Integer.parseInt(yyString))
%>
<OPTION SELECTED= <%=i%> > <%=i%> </option>
<%
else
%>
<OPTION VALUE= <%=i%> > <%=i%> </option>
%>
<%
%>
</select>
<input type="button" value="Display" onClick="showCalendar()">
<br><br>
<div id="descr" style="visibility:hidden">Enter Description : <input type="text" name="descText" value=""> </div>
<br>
<%
String driverName = "com.mysql.jdbc.Driver";
Class.forName(driverName);
String serverName = "192.168.10.5";
String mydatabase = "Trainees";
String url = "jdbc:mysql://" + serverName + "/" + mydatabase;
String username = "venkat";
String password = "venkat";
con = DriverManager.getConnection(url, username, password);
Statement stmt = null;
ResultSet rset = null;
PreparedStatement PREPstmt1;
stmt = con.createStatement();
rset=stmt.executeQuery("select count(*) from Holiday where YEAR(HolidayDate)='"+yyString+"'");
int cnt=0;
boolean ALflag=false;
while(rset.next())
cnt= rset.getInt(1);
out.println("count is : "+cnt);
if(cnt>1)
ALflag=true;
%>
<%
rset=stmt.executeQuery("select count(*) from Holiday where Weekender='N'");
int cnte=0;
boolean SELflag=false;
while(rset.next())
cnte = rset.getInt(1);
out.println("count is : "+cnte);
if(cnte>1)
SELflag=true;
%>
<%!
String[] months = {
"January", "February", "March",
"April","May", "June",
"July", "August","September",
"October", "November", "December"
int dom[] = {
31, 28, 31, 30,
31, 30, 31, 31,
30, 31, 30, 31
%>
<%
int leadGap = 0;
%>
<table border="0" width="100%" align="Left">
<%
GregorianCalendar calendar =null;
for(int j=0;j<12;j++)
calendar = new GregorianCalendar(yy, j, 1);
if(j==0 || j%3==0)
%>
<tr>
<%
%>
<td halign="top" >
<table border="1" width="33%" align="Left"><tr align="right">
<th colspan=7>
<%= months[j] %>
<%= yy %>
</th>
</tr>
<tr>
<td>Sun<td>Mon<td>Tue<td>Wed<td>Thu<td>Fri<td>Sat
</tr>
<%
leadGap = calendar.get(Calendar.DAY_OF_WEEK)-1;
int daysInMonth = dom[j];
if (calendar.isLeapYear(calendar.get(Calendar.YEAR)) && j == 1)
++daysInMonth;
out.println("<tr>");
out.println(" ");
for (int i = 0; i < leadGap; i++)
out.print("<td> </td>");
for (int iday = 1; iday <= daysInMonth; iday++)
out.println("<td>");
int dayOfWeek = (leadGap + iday) % 7;
GregorianCalendar today = new GregorianCalendar();
if(today.get(Calendar.DATE) == iday && today.get(Calendar.MONTH) == j)
todayId = iday+"-"+(j+1);
%>
<div id="<%=((j+1)+"-"+iday)%>" onClick="selectDate(this)" style="background-color:#cccc00" title="" ><%=iday %></div>
<%
else
if(dayOfWeek <= 1)
String str = yyString+"-"+(j+1)+ "-"+ iday;
if((dayOfWeek == 0) && (ALflag==false))
String query = "insert into Holiday VALUES ('" + str + "','Saturday','Y')";
stmt=con.createStatement();
stmt.executeUpdate(query);
else if ((dayOfWeek == 1) && (ALflag==false))
String query = "insert into Holiday VALUES ('" + str + "','Sunday','Y')";
stmt=con.createStatement();
stmt.executeUpdate(query);
%>
<div id="<%=((j+1)+"-"+iday)%>" onClick="selectDate(this)" style="background-color:#cccccc" title=""> <%=iday %></div>
<%
else
%>
<div id="<%=((j+1)+"-"+iday)%>" onClick="selectDate(this)" style="background-color:white" title="" ><%=iday %></div>
<%
out.println("</td>");
if(calendar.getActualMaximum(Calendar.DAY_OF_MONTH) == iday)
out.println("</td></tr></table>");
else if ((leadGap + iday) % 7 == 0)
out.println("</tr>");
out.println("<tr>");
%>
</td>
<%
if((j+1)%3==0)
%>
</tr>
<%
%>
<input type="hidden" name="lastDateId" value="<%=todayId%>">
<input type="hidden" name="todayId" value="<%=todayId%>">
<input type="hidden" name="list" value="">
<input type="submit" value="Submit" onClick="setTitle()">
</form>
</body>
</table>
</html>
This is the extract of the above code. This is how i have provided the query. In which part of my above code should i provide the coloring aspect. If the (SELflag==false), then i want to provide the color. where should i give? please help
<%
rset=stmt.executeQuery("select count(*) from Holiday where Weekender='N'");
int cnte=0;
boolean SELflag=false;
while(rset.next())
cnte = rset.getInt(1);
out.println("count is : "+cnte);
if(cnte>1)
SELflag=true;
%>Here is the calendar code, which i have used. Where should i use the code to check . i am able to get the count of user inputted days. i want to use the code,
if(SELflag==false)
give color.
where can i give this if code, to get the color?
<%
rset=stmt.executeQuery("select count(*) from Holiday where Weekender='N'");
int cnte=0;
boolean SELflag=false;
while(rset.next())
cnte = rset.getInt(1);
out.println("count is : "+cnte);
if(cnte>1)
SELflag=true;
%>
<%!
String[] months = {
"January", "February", "March",
"April","May", "June",
"July", "August","September",
"October", "November", "December"
int dom[] = {
31, 28, 31, 30,
31, 30, 31, 31,
30, 31, 30, 31
%>
<%
int leadGap = 0;
%>
<table border="0" width="100%" align="Left">
<%
GregorianCalendar calendar =null;
for(int j=0;j<12;j++)
calendar = new GregorianCalendar(yy, j, 1);
if(j==0 || j%3==0)
%>
<tr>
<%
%>
<td halign="top" >
<table border="1" width="33%" align="Left"><tr align="right">
<th colspan=7>
<%= months[j] %>
<%= yy %>
</th>
</tr>
<tr>
<td>Sun<td>Mon<td>Tue<td>Wed<td>Thu<td>Fri<td>Sat
</tr>
<%
leadGap = calendar.get(Calendar.DAY_OF_WEEK)-1;
int daysInMonth = dom[j];
if (calendar.isLeapYear(calendar.get(Calendar.YEAR)) && j == 1)
++daysInMonth;
out.println("<tr>");
out.println(" ");
for (int i = 0; i < leadGap; i++)
out.print("<td> </td>");
for (int iday = 1; iday <= daysInMonth; iday++)
out.println("<td>");
int dayOfWeek = (leadGap + iday) % 7;
GregorianCalendar today = new GregorianCalendar();
if(today.get(Calendar.DATE) == iday && today.get(Calendar.MONTH) == j)
todayId = iday+"-"+(j+1);
%>
<div id="<%=((j+1)+"-"+iday)%>" onClick="selectDate(this)" style="background-color:#cccc00" title="" ><a href="#" style="text-decoration:none;color:808080"><%=iday %> </a></div>
<%
else
if(dayOfWeek <= 1)
String str = yyString+"-"+(j+1)+ "-"+ iday;
if((dayOfWeek == 0) && (ALflag==false))
String query = "insert into Holiday VALUES ('" + str + "','Saturday','Y')";
stmt=con.createStatement();
stmt.executeUpdate(query);
else if ((dayOfWeek == 1) && (ALflag==false))
String query = "insert into Holiday VALUES ('" + str + "','Sunday','Y')";
stmt=con.createStatement();
stmt.executeUpdate(query);
%>
<div id="<%=((j+1)+"-"+iday)%>" onClick="selectDate(this)" style="background-color:#cccccc" title=""> <a href="#" style="text-decoration:none;color:808080"><%=iday %> </a></div>
<%
else
%>
<div id="<%=((j+1)+"-"+iday)%>" onClick="selectDate(this)" style="background-color:white" title="" ><a href="#" style="text-decoration:none;color:808080"><%=iday %> </a></div>
<%
out.println("</td>");
if(calendar.getActualMaximum(Calendar.DAY_OF_MONTH) == iday)
out.println("</td></tr></table>");
else if ((leadGap + iday) % 7 == 0)
out.println("</tr>");
out.println("<tr>");
%>
</td>
<%
if((j+1)%3==0)
%>
</tr>
<%
%>
<input type="hidden" name="lastDateId" value="<%=todayId%>">
<input type="hidden" name="todayId" value="<%=todayId%>">
<input type="hidden" name="list" value="">
<input type="submit" value="Submit" onClick="setTitle()">
</form>
</body>
</table>
</html>
Maybe you are looking for
-
In Aperture3 File Status - cannot find it in Filter as option?
Am trying to move all of my remaining masters located on my laptop to an external drive. 80% of them are already in a referenced library on an external drive. Trying to filter the pictures by using Command F (Find) and the Aperture 3 manual shows the
-
WebDynpro ABAP u2013 Travel Management Floor Plan Manager Queries
Hi, Travel Management in WebDynpro for ABAP uses FPM (floor plan manager). General Data View in FITE_VC_GENERAL_DATA component is being shared by Travel Creation component and travel expense as well. Can you please help to ans below queries? 1 >> I w
-
How to change the short name????
i bought this iBook G4 off a friend and i was only able to change the name and pass on the account part and was not able to change the short name... it a chicks name so i dont want that to show on there,, does anybody know how to change that ??? than
-
JCO Connection and Changing Parameters
Hi, I am trying to retrive the content populated in changing parameter using the following code JCoTable titles = function.getChangingParameterList() .getTable("TITLE_HELP");
-
Creating index for standard SAP tables
Hi! What are the advantages and disadvantages of creating addtional indexes for tables with massive amount of data (BSEG, BKPF, COEP, etc...). If I create a new index it supposed to make the table access faster, for the cost of hard disk space. Am I