I am using NetBeans and I have the MySQL server with SQL db running on my computer. I have a desktop app with embedded db. I would like to find some good info on how to add button functionality to initiate another desktop app.
I would like to explore possibilities to initiate the MySQL command window. Is there a good way to add functionality of these applications so to have them available on my main desktop?
My interest concern importing the eclipse file that could start the???.jar when the button actions fired. so I would need Java code that I could put in this class.
ceyesuma -4 Posting Pro
Hello.
I was trying a new apache derby SQL prepardstatement to send numbers incremented form one into three tables.
if it find the number in any of the tables than it is not the number I need to create the next primary key
in my payment table.
I am not sure if the logic is correct and I am not sure if searching three tables is checking all the records.
Does someone know how this could be done?
There is no error. my payment table contains pymt_num=1 already. In my attempt (shown in output) It test the integer one
and it passes. Actually, there is an error when the form continues to insert the payment record where it will
not duplicate the primary key (pymt_num = "1").
It should find any foreign key pymt=1 and primary key pymt_num=1 and trigger the generation of another number. I did not include the integer generator.
uniqueBookingAndTotalsPymtNum: <--statement
CLASS
public class ConnectBookingDAO extends MasterForm implements BookingDAO {:
--> in public boolean bUniquePaymentNumber((1) var: (int num)<--
: SELECT b.pymt,t.pymt,p.pymt_num FROM booking AS b,booking_totals AS t,payment AS p WHERE b.pymt=? OR t.pymt=? OR p.pymt_num=?
public boolean bUniquePaymentNumber(int aNum) throws SQLException, FileNotFoundException, IOException, UnknownUserNameException, IncorrectPasswordException, LoginException, ProfileException, InterruptedException {
int num = aNum;
bUniqueBookNum = true;
bUniqueTotalsNum = true;
bUniquePaymentNum=true;
bUnique = true;
//unique means that it is unique (not in table so it is what we are looking for.
//it is not there to …
ceyesuma -4 Posting Pro
Personally, I use Netbeans to create a master GUI with basic component needed because
it is so much quicker. Besides component placement and the adjusting name
and the "code" Variable Modifiers (public static ... etc) it turns into a mess.
So once there is a master template created then you could extend as many times as you want and have different components and objectives and start learning how to hand code adding listeners and storing values,buttons etc.
As you pin point what you need to fix there is ample examples for specific needs
good luck
ceyesuma -4 Posting Pro
Hello all.
In my Apache derby db I set up Decimal data types like this:
admin_pay_rate DECIMAL(5,2),
I use JFormattedTextFields to filter decimal usage in text fields concerning money
Like admin pay rate would be 150.00: this is good.
In the JFormattedTextField it will allow 1,000.00 but the db crashes when this
Decimal is presented.
Will I have to change the db data type ?
admin_pay_rate DECIMAL(5,2),
I am not sure about maxValue in my class. Because I am not sure what is a good value
Or how to change maxValue to restrict a value that exceeds what the data base considers
A double.
Would someone know the best way to coordinate the field with the db ?
It works ok for now but the user has the ability to present number like
1,000,000,000.00 and in most of the values I am working with are not
that big.
package view.utils.formattedFields;
import java.beans.PropertyChangeSupport;
import java.io.Serializable;
import java.text.DecimalFormat;
import javax.swing.JFormattedTextField;
import javax.swing.text.DefaultFormatterFactory;
import javax.swing.text.NumberFormatter;
/**
* Provides a JFormattedTextField that accepts only doubles. Allows for the setting of the number
* of decimal places displayed, and min/max values allowed.
*
* @author Mark Pendergast
* Copyright Mark Pendergast
*/
public class FormattedDoubleField extends JFormattedTextField implements Serializable{
public static final String PROP_MINVALUE_PROPERTY = "minimum value";
public static final String PROP_MAXVALUE_PROPERTY = "maximum value";
public static final String PROP_DECIMALPLACES_PROPERTY = "decimal places";
public static final String displayFormat = "#,###,##0.000000000000000";
public …
ceyesuma -4 Posting Pro
Hello
I have created a multi tabbed JDesktopPane that will load 5 different configurations depending on the profile of the user logged in that has dozens of forms
And dozens of interactive JInternalFrames, JList, JTables, JTrees and a complete unique file system that is created for each new user sorted by profile. The user
Can interact and maintain different file procedures and additionally save Application created serialized multi tabbed JInternalFrames to maintain a note taking system. The application is built using the MV2 framework and it interacts with a Derby embedded Database through properties files, XML properties and a DAO.
I described the App to explain the App already has a strong Model, View Business logic in place and in good working order and the business rules are implemented already and being refined and debugged.
The First order of business that I can assess is that the DB will need to be switched when the Web App is initiated. My Desktop App has a basic undeveloped
Structure in place that implements a DAOFactory (if you will) and a package that contains Interfaces for each DAO. I have no experience at all with Interfaces
What so ever. Totally ignorant of any use it could have but I tried to tag it along as I created the App hoping it could be useful at a later date.
I would like to develop the Desktop Application into a combined Web Application. I would …
ceyesuma -4 Posting Pro
enums are fully defined in the source code and are in effect initialised when they are loaded by the classloader. There is nothing you can do to change their values at run time. So if you need to do something else, enums are not the solution.
Can you give a simple description of what it is you are trying to achieve?
Thank you that was my problem I was ignorant of how the Enumerations were loaded.
not a good thing. so I worked around a new constructor.
Actually the data types concern me here because I am not sure of if they will be usefull. My form sets the said
setters with different data types and my values()
returns some good data yet the first column represents
the date that should be changing so I changed the constructor on my class that uses the Enumeration to track
the new "element". I have to evaluate the results too but this is what I returned.
thanks for your time.
private boolean prepareRecord(DateTime[] processDates) throws SQLException, FileNotFoundException, IOException {
bDone = true;
DateTime startTimeField =
LocationAvailableFormController.locationAvailableDataModel.locationAvailableBean.startTimeValue;
DateTime endTimeField =
LocationAvailableFormController.locationAvailableDataModel.locationAvailableBean.endTimeValue;
LocationAvailableFormController.setStartTimeField(startTimeField);
LocationAvailableFormController.setEndTimeField(endTimeField);
LocationAvailableFormController.setLocationDesc(thisLocation);
LocationAvailableFormController.setTableName(tableName);
for (int i = 0; i < processDates.length; i++) {
DateTime element = processDates[i];
LocationAvailableFormController.setAvailableDate(element);
InitalizeData id =new InitalizeData(element);
}
return bDone;
}
InitalizeData.java
public InitalizeData(DateTime element) {
for(AvailabilityRecordEnum data : AvailabilityRecordEnum.values()){
System.out.printf("%s\t%s\t%s\t%s\t%s\t%s\t%s\n", element,data.getEndDate(),data.getEndHour(),
data.getStartHour(),data.getTimeSlots(),data.getLocationDesc(),data.getTableName());
}
}
some output:
Monday<----looking for
Wednesday<----looking for
Friday<----looking for
2011-06-01T16:00:00.000-05:00 …
ceyesuma -4 Posting Pro
I will have to scrap this Enumeration and revert back to my convoluted cluster
of for loops and multi dimensional arrays intialized by lists lol
Because I do not see how these Enums load in the first place because the pattern
below is almost the same as a constants (objects) having parameters but instead of
it being a
LocationAvailableConstant("2011-06-27", ect
I expect it to get that value from another class.
I guess there is no way to make a re-usable Enumeration.
thanks anyway.
public enum AvailabilityRecordEnum {
LocationAvailableConstant(LocationAvailableFormController.getAvailableDate(),
LocationAvailableFormController.getStartTimeField(),
LocationAvailableFormController.getEndTimeField(),
LocationAvailableFormController.getEndDate(),
LocationAvailableFormController.getLocationDesc(),
LocationAvailableFormController.tableName);
private DateTime dt;
private DateTime startHour;
private DateTime endHour;
private DateTime endDate;
private String locationDesc;
private String tableName;
private int timeSlots;
AvailabilityRecordEnum(DateTime startDate,
DateTime startHourField,
DateTime endHourField,
DateTime endDateConstant,
String thisLocation,
String thisTableName) {
dt = startDate;
startHour = startHourField;
endHour = endHourField;
endDate = endDateConstant;
locationDesc = thisLocation;
tableName = thisTableName;
startHourToEndHourtimeSlots();
}
private void startHourToEndHourtimeSlots() {
int diff = JodaTimeUtil.differenceInHours(startHour, endHour);
timeSlots = diff;
setTimeSlots(timeSlots);
}
public int getTimeSlots() {
return timeSlots;
}
public void setTimeSlots(int timeSlots) {
this.timeSlots = timeSlots;
}
}
ceyesuma -4 Posting Pro
Thanks for that link. I have seen that an a few others and the problem right from the
start is that all the examples I have seen ,probably for good reason, instantiate
constants that never change.
I have seen constants set up as:
enum Grade {
A, B, C, D, F, INCOMPLETE
};
and I just looked at an Enumeration that gets initialized by a class
enum AntStatus {
INITIALIZING,
COMPILING,
COPYING,
JARRING,
ZIPPING,
DONE,
ERROR
}
public class AntStatusTester {
public AntStatusTester() { }
public void testEnumMap(PrintStream out) throws IOException {
// Create a map with the key and a String message
EnumMap<AntStatus, String> antMessages =
new EnumMap<AntStatus, String>(AntStatus.class);
// Initialize the map
antMessages.put(AntStatus.INITIALIZING, "Initializing Ant...");
antMessages.put(AntStatus.COMPILING, "Compiling Java classes...");
antMessages.put(AntStatus.COPYING, "Copying files...");
antMessages.put(AntStatus.JARRING, "JARring up files...");
antMessages.put(AntStatus.ZIPPING, "ZIPping up files...");
antMessages.put(AntStatus.DONE, "Build complete.");
antMessages.put(AntStatus.ERROR, "Error occurred.");
I do not have a grasp of this yet because I would probably try to change my code to some how initialize my
LocationAvailableEnum
as some kind of list as apposed to the above map. I guess I am not clear on what would be possible because my rough I posted earlier needs to feed a set of data into the Enumeration and be able to change the data for each element in
for (int i = 0; i < processDates.length; i++) {
DateTime element = processDates[i];
//LocationAvailableEnum();
}
Clearly I am not grasping some basic concept.
Thanks
ceyesuma -4 Posting Pro
I went and tried to learn how to use Enum So I apologize for the lack of logical construction but I had
to start somewhere I have code that I am not sure how to use it because I don't know
how to call it so all the logic went down the tubes.
Can someone look at this and tell me if it is even possible?
If you have any clue what I am tring to do any feed back would be most usefull to say the least.
Thanks for your time.
I am tring to send the AvailablilityRecordEnum each of the processDates elements with its unique data to be
kept with it all the way to the insert.
private boolean prepareRecord(DateTime[] processDates) throws ... {
//set everything in one location
DateTime startTimeField =
LocationAvailableFormController.locationAvailableDataModel.locationAvailableBean.startTimeValue;
DateTime endTimeField =
LocationAvailableFormController.locationAvailableDataModel.locationAvailableBean.endTimeValue;
LocationAvailableFormController.setStartTimeField(startTimeField);
LocationAvailableFormController.setEndTimeField(endTimeField);
LocationAvailableFormController.setLocationDesc(thisLocation);
LocationAvailableFormController.setTableName(tableName);
//some how call the enum so it can throw my firs error...
for (int i = 0; i < processDates.length; i++) {
DateTime element = processDates[i];
AvailabilityRecordEnum.LocationAvailableEnum();
}
return bDone;
}
I just copied a structure that seemed logical and that I am done it makes no sense :
public enum AvailabilityRecordEnum {
LocationAvailableEnum(LocationAvailableFormController.getAvailableDate(),
LocationAvailableFormController.getStartTimeField(),
LocationAvailableFormController.getEndTimeField(),
LocationAvailableFormController.getEndDate(),
LocationAvailableFormController.getLocationDesc(),
LocationAvailableFormController.tableName);
public DateTime dt; // each record
public static DateTime startDate;
public DateTime startHour;
public DateTime endHour;
public DateTime endDate;
public String locationDesc;
public int timeSlots;
public String tableName;
// Constructor
AvailabilityRecordEnum(DateTime startDate,
DateTime startHourField,
DateTime endHourField,
DateTime endDateConstant,
String …
ceyesuma -4 Posting Pro
Interesting. I will have to look at the List Collections.synchronizedList and
find out how it will work with my present operation.
I have wrote a rough draft of a List that is loaded with DateTimes.From each element I can extrapolate three pieces of data that need to be kept together and synchronized with related data from a record. Some list will not guarantee everytning will be kept in order.
The whole operation is to end up with several data types to be turned into strings
and used to query and insert in a db.
Needless to say Collections.list,arrays etc. will make it quite confusing.
Thanks for the info and I will end this post saying I am going to explore the Enumeration maybe I will find that they are the solution.
ceyesuma -4 Posting Pro
don't forget to use a WildCard, f.e. Vector<String>, Vecto<Vector<Object>>... everyting about that is on Web
Ok, Wild card you got me there I will have to spend more time on
vectors.
All I thought I knew about Vectors is that there was no data type when
loading it and
to unload it I had to cast the element on the way out.
for (Enumeration e = frameVector.elements(); e.hasMoreElements();) {
JInternalFrame frame = (JInternalFrame) e.nextElement();
createKeyAndValues(frame);
}
just google Vectors +wildCard ?
ceyesuma -4 Posting Pro
http://www.java2s.com/Tutorial/Java/0140__Collections/MultidimensionalVectorsVectorsofVectors.htm
http://download.oracle.com/javase/6/docs/api/java/util/Vector.html
Thanks I have not used vectors a whole lot. The links were good links to add to my collection.
The Vector class said:
As of the Java 2 platform v1.2, this class was retrofitted to implement the List interface, making it a member of the Java Collections Framework. Unlike the new collection implementations, Vector is synchronized.
and my ide says:
This inspection reports any uses of java.util.Vector or java.util.Hashtable. While still supported, these classes were made obsolete by the JDK1.2 collection classes, and should probably not be used in new development.
The Api did not mention anything about Vector being depreciated or obsolete.
I guess my IDE is out dated.
Thank god. I just spent 4 hours working aroud it. Vectors are our friend!
I'll be happy to delete all of it and start over.
take care
ceyesuma -4 Posting Pro
You may want to pay attention to setString(1,val1) as it should not interfere with the Primary key.
when I set the strings I start with the data needed and I do not attempt to alter the primary key so there are
six columns in the db but five values "?"
hope that helps.
I am not sure of what you may be up against. I just know that the following example works and it
may help you find your error.
good luck.
create table:
<entry key="createLocationAvailable"> CREATE TABLE location_available(
record_num SMALLINT NOT NULL GENERATED ALWAYS AS IDENTITY(START WITH 1,INCREMENT BY 1),
loc_desc VARCHAR(70),
available_start_date DATE,
available_end_date DATE,
available_start_time TIME,
available_end_time TIME
)
</entry>
insert xml
<entry key="insertLocationAvailable">INSERT INTO location_Available(
loc_desc,
available_start_date,
available_end_date,
available_start_time,
available_end_time)
VALUES (?, ?, ?, ?, ?)
</entry>
You may want to pay attention to setString(1,val1) as it should not interfere with the Primary key.
public boolean primaryInsertLocationAvailable() throws FileNotFoundException {
boolean bInsert = true;
setTableName(tableName);
try {
close(conn, ps);
conn = connect();
locationAvailableUser = MasterRegisterForm.locationAvailableBean;
ps = (PreparedStatement) conn.prepareStatement(
ModelUtils.getXMLResource("insertLocationAvailable"));
ps.setString(1, locationAvailableUser.getLocationDesc());
ps.setDate(2, (java.sql.Date) locationAvailableUser.getAvailableStartDate());
ps.setDate(3, (java.sql.Date) locationAvailableUser.getAvailableEndDate());
ps.setTime(4, (java.sql.Time)locationAvailableUser.getAvailableStartTime());
ps.setTime(5, (java.sql.Time)locationAvailableUser.getAvailableEndTime());
int rowCount = ps.executeUpdate();
if (rowCount != 1) {
bInsert = false;
throw new RegisterException();
} else {
throw new SuccessfullRegistrationMessage();
}
} catch (InterruptedException ex) {
Logger.getLogger(LocationAvailableSupplementalDAO.class.getName()).log(Level.SEVERE, null, ex);
} catch (RegisterException e) {
String x = e.getMessage();
System.out.println("error message is: " + x);
ViewUtils vu = new ViewUtils();
vu.addExceptionMessage(x);
} …
ceyesuma -4 Posting Pro
I was reading some code that encouraged the use of vectors but my IDE is saying that it is an obsolete Collection.
I need to use Vector because it can does not need to be a set size. and I would
like to have a Vector of Vectors. Is there some other way to do this?
Maybe an example of a list of list or some other kind of collection.
thanks
ceyesuma -4 Posting Pro
That is too much . I would have to set a pattern and figue out how to use
the defaultformatter etc.
I just validate the range on submit. thanks.
try {
////////////// are the hour fields valid?
int sub = Integer.parseInt(txtFieldArray[startTimeAvailableIndex].getText().substring(0, 2));
System.out.println(C + M + AND + sub + ":sub : \n");
if (sub > 23) {
cancelUpdate();
txtFieldArray[startTimeAvailableIndex].setText("");
bValid = false;
throw new model.err.InvalidHourValueException();
}
sub = Integer.parseInt(txtFieldArray[endTimeAvailableIndex].getText().substring(0, 2));
if (sub > 23) {
cancelUpdate();
txtFieldArray[endTimeAvailableIndex].setText("");
bValid = false;
throw new model.err.InvalidHourValueException();
}
} catch (InvalidHourValueException ex) {
String x = ex.getMessage();
System.out.println("Error: " + x);
ViewUtils vu = new ViewUtils();
vu.addExceptionMessage(x);
}
ceyesuma -4 Posting Pro
or better yet can someone decipher this one ?
private static final String TIME_PATTERN_24_HOUR = "(0[0-9]|1[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])";
ceyesuma -4 Posting Pro
Is there someone that can decipher this?
private static final String EMAILPATTERN = "^[\\w\\-]([\\.\\w])+[\\w]+@([\\w\\-]+\\.)+[A-Z]{2,4}$";
can I use something similar to just allow [0-23]?
ceyesuma -4 Posting Pro
My MASKFORMAT is "##:00" which allow rounded hours but can I include that ## can only contain [0-23]?
what would that code look like?
private PropertyChangeSupport propertySupport;
public static final String PROP_TICKING_PROPERTY = "clock is active";
//public static final String MASKFORMAT = "##/##/#### ##:##:## UM";
public static final String MASKFORMAT = "##:00";
//public static final String SIMPLEDATEFORMATMASK = "yyyy-MM-dd HH:mm:ss a";
public static final String SIMPLEDATEFORMATMASK = "H:mm";
private SimpleDateFormat sdf = new SimpleDateFormat(SIMPLEDATEFORMATMASK);
private static final int TIMERINTERVAL = 1000000000;
private Timer timer = new Timer(TIMERINTERVAL, this);
private boolean ticking = true;
ceyesuma -4 Posting Pro
I think you are right. Keep it simple. I don't know the scope of
data I will need later for calanders,forms,lists etc.
I will use 2011-05-04
because I see 2011-05-04 07:00:57 CDT
every where and I may need
some of that info later. java.util.Date and calander is hard enough to learn
without changing formats. Someone should re-write it.
I installed Joda to learn some calanders but no progress yet.
thanks for your reply.
ceyesuma -4 Posting Pro
Below is how I set up my JFormattedTExtField.
The database (derby) will take the format no prob.
The db will then change the form to yyyy-MM-dd
If I follow that format from begining to end the JFormatted Field
will be fine.
However, when a date is queried from the database and put back to
the field nothing shows becaue the formats are now different.
so it goes in fine the way I set it up.but I need it to output it
in a format I am comforable with MM/dd/yyyy.
is there a way to do this?
CLASS
public class FormattedDateField extends JFormattedTextField implements ActionListener, Serializable{:
-->public FormattedDateField(Wed May 11 06:00:04 CDT 2011) var: ((Date date))<--
: : caller
--> : DefaultFormatterFactory() : var: xxxx : xxxxxxx <--
--> in public FormattedDateField() var: xxxxxxxxx : xxxxxxxx<--
CLASS
public class FormattedDateField extends JFormattedTextField implements ActionListener, Serializable{:
--> in public FormattedDateField() var: xxxxxxxxx : xxxxxxxx<--
: ##-##-####: MASKFORMAT:
CLASS
public class FormattedDateField extends JFormattedTextField implements ActionListener, Serializable{:
--> in public FormattedDateField() var: xxxxxxxxx : xxxxxxxx<--
: MM-dd-yyyy: SIMPLEDATEFORMATMASK:
--> in public static synchronized ResourceBundle getResources() var: xxxxxxxxx : xxxxxxxx<--
--> in public JFormattedTextField fieldSetup(INSTR_DOB) var: (String fieldName)<--
-->public FormattedDateField(Wed May 11 06:00:04 CDT 2011) var: ((Date date))<--
CLASS
public class FormattedDateField extends JFormattedTextField implements ActionListener, Serializable{:
-->public FormattedDateField(Wed May 11 06:00:04 CDT 2011) var: ((Date date))<--
: ##-##-####: MASKFORMAT:
CLASS
public class FormattedDateField extends JFormattedTextField implements ActionListener, Serializable{:
-->public FormattedDateField(Wed May 11 06:00:04 …
ceyesuma -4 Posting Pro
@ ceyesuma
:-) +1, this about real usage of, not about possibilities
<:-)> and then tell us how you can use myStle.css correctly (more than 500lines CustomWoodoo about definitions for create Stylled Document from SomeJavaGuru) and with todays Html syntax (Html ver.> 3.2), yes there are exist 3.rd part API </:-)>
We live and learn. Thanks for the heads up for some better code.
ceyesuma -4 Posting Pro
First of all you need to create a pattern of date.
SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy"); ...
Thanks that works good
if (i == 7) {
SimpleDateFormat sdf = new SimpleDateFormat();
sdf.applyPattern("MM/dd/yyyy");
Date utilDate=sdf.parse(txtFieldArray[i].getText());//12/31/1955
java.sql.Date sqlDate=new java.sql.Date(utilDate.getTime());
instructorBean.setStartDate(sqlDate);
}
ceyesuma -4 Posting Pro
Sorry mKorbel I guess JamesCerrill upset you too.
I'm here to share code ;)
lol
I did look at a new browser code and I dumped it in the code I gave
you.
I simply sent in the url and it works beautiful: just use this method
or make it a class.
public static void onLaunchBrowser(String url) throws URISyntaxException {
if (Desktop.isDesktopSupported()) {
desktop = Desktop.getDesktop();
// now enable buttons for actions that are supported.
}
URI uri = null;
try {
uri = new URI(url);
desktop.browse(uri);
}
catch(IOException ioe) {
ioe.printStackTrace();
}
catch(URISyntaxException use) {
use.printStackTrace();
}
}
good luck.
ceyesuma -4 Posting Pro
When I parse this date:
SimpleDateFormat sdf = new SimpleDateFormat();
Date utilDate=sdf.parse(txtFieldArray[i].getText());//12/31/1955
java.sql.Date sqlDate=new java.sql.Date(utilDate.getTime());
instructorBean.setStartDate(sqlDate);
error
May 9, 2011 7:10:43 PM view.forms.profileForms.InstructorProfileForm actionPerformed
SEVERE: null
java.text.ParseException: Unparseable date: "12/28/1955"
at java.text.DateFormat.parse(DateFormat.java:337)
Can someone show me some code on a date that can be parsed?
ceyesuma -4 Posting Pro
Here is a Browser and some links to examples. Maybe you can send it a address when you need it good luck.
package view.utils;
/* Examples:
* Browser.displayURL("http://www.javaworld.com")
* Browser.displayURL("file://c:\\docs\\index.html")
* BrowserContorl.displayURL("file:///user/joe/index.html");
*
* Note - you must include the url type -- either "http://" or "file://".
*/
//C:\Users\depot\Documents\ceyesumma\java_cache\my_projects\schooldb_project\target_schooldb\schooldb\schoolofdb\src\view\learn\guitar\gm\bin\index.html
import java.io.*;
import java.lang.reflect.Method;
import java.lang.reflect.InvocationTargetException;
//import com.apple.mrj.MRJFileUtils; // For Mac
//temp path to file loading guitarmaster
/*
* C:\Users\depot\Documents\ceyesumma\java_cache\my_projects\guitar_master_project\target_guitar_master\guitar_master\guitar_master\src
*/
public class Browser {
// ---------- Define constants:
public static final String FileProtocol = "file://";
// Used to identify the windows platform.
private static final String WIN_ID = "Windows";
// The default system browser under windows.
private static final String WIN_PATH = "rundll32";
// The flag to display a url.
private static final String WIN_FLAG = "url.dll,FileProtocolHandler";
// For NT ??? "cmd /c Notepad.exe D:\\temp\\test.txt"
// Id mac
private static final String Mac_ID = "Mac OS";
// The default browser under unix.
private static final String UNIX_PATH = "netscape";
// The flag to display a url.
private static final String UNIX_FLAG = "-remote openURL";
final static boolean debug = true; //true; // For testing
/**
* Display a file in the system browser.If you want to display a
* file, you must include the absolute path name.
*
* @param url the file's url (the url must start with either "http://" or
* "file://").
*/
public static void displayURL(String url) {
boolean windows = isPlatform(WIN_ID);
boolean mac = isPlatform(Mac_ID);
String cmd = null;
try {
if (windows) …
ceyesuma -4 Posting Pro
Hello all.
The Java Date and time classes are difficult.
I think I have to use java.sql.Date which is a sub
class of Date but is not a date unless the time is normalized to zero.
so I've heard.
I would like to work with my studentDOB first by collecting
a JFormatted field/put it in the bean /get the value from the bean/
put it back into the JFormatted textField.
I have DAO classes to collect and put results back to a form
Could someone help me get started with an example?
I use a JFormattedTextField that collect a obj as 12/31/2011. I don't
need mm,ss ect unless it is easier to start with
To collect the data to set the studentDOB I use
if (i == 7) {
studentBean.setDob((Date) (txtFieldArray[i].getValue()));//format wanted 12/31/2011
}
I setString using
Just testing it using the :
----> ps.setDate(7, (java.sql.Date) studentUser.getDob());<----working with this one for now
@Override
public boolean insertStudent() throws FileNotFoundException, IOException, SQLException {
boolean insert = true;
studentUser = MasterRegisterForm.studentBean;
setTableName(tableName);
try {
conn = connect();
ps = (PreparedStatement) conn.prepareStatement(
ModelUtils.getXMLResource("insertStudent"));
ps.setString(1, studentUser.getNewUserUid());
ps.setString(2, studentUser.getNewUserPassword());
...
----> ps.setDate(7, (java.sql.Date) studentUser.getDob());<----working with this one for now
...
ps.setString(14, studentUser.getEmail());
int rowCount = ps.executeUpdate();
if (rowCount != 1) {
insert = false;
close(conn, ps);
throw new RegisterException();
} else {
close(conn, ps);
throw new SuccessfullRegistrationMessage();
}
} catch (InterruptedException ex) {
Logger.getLogger(StudentSupplementalDAO.class.getName()).log(Level.SEVERE, null, ex);
} catch (RegisterException e) {
insert = false;
String x = …
ceyesuma -4 Posting Pro
Java and I just started using DOM I need to fight it for a while to learn basics.
I have a working solution. It may be over kill but it ends up rewriting xml
I'll post the example.
original xml
NOTE: The linkDesc will be altered.
<?xml version="1.0" encoding="utf-8"?>
<links>
<link action="save">
<linkName>ceyesumma@hotmail.com</linkName>
<linkPath>ceyesumma@hotmail.com</linkPath>
<linkDesc>User Email</linkDesc>
</link>
<link action="save">
<linkName>ceyesumma@hotmail.com</linkName>
<linkPath>ceyesumma@hotmail.com</linkPath>
<linkDesc>User Email</linkDesc>
</link>
<link action="save">
<linkName>www.hotmail.com name</linkName>
<linkPath>www.hotmail.com</linkPath>
[b] <linkDesc>The original description.</linkDesc> [/b]
</link>
</links>
find the element and save the data in text nodes and introduce new data to the linkDesc tag
private void processForEdit(Element e) throws FileNotFoundException{
if (e != null) {
child = e.getChildNodes();
for (int z = 0; z < child.getLength(); z++) {
Element element = (Element) child.item(z);
String name = element.getTagName();
if (element.getNodeName().equals(LINKNAME)) {
if (element.TEXT_NODE > 0) {
value = getTextValue(child.item(z));
if (value != null) {
setLinkName(value);
}
}
}
if (element.getNodeName().equals(LINKPATH)) {
if (element.TEXT_NODE > 0) {
value = getTextValue(child.item(z));
if (value != null) {
setLinkPath(value);
}
}
}
if (element.getNodeName().equals(LINKDESC)) {
setLinkDesc(OpenURLListSelectionPanel.descTxtField.getText());
}
}
Document thisDoc = getDoc();
root.removeChild(e);
NoteRewriteElementXML nre = new NoteRewriteElementXML();
nre.appendToOriginalXMl(thisDoc, linkName, linkPath, linkDesc);
}
}
change the document,transform the doc and rewrite the xml
public NoteRewriteElementXML() throws IOException{
}
public void appendToOriginalXMl(Document doc,String linkName,String linkPath,String linkDesc) throws IOException {
this.doc=doc;
NoteRewriteElementXML.linkName=linkName;
NoteRewriteElementXML.linkPath=linkPath;
NoteRewriteElementXML.linkDesc=linkDesc;
frame = MusicSystemsJDesktopManager.getCurrentFrame();
MusicSystemsJDesktopManager.setCurrentFrame(frame);
frameName = frame.getTitle();
JTabbedPane pane = (JTabbedPane) frame.getContentPane().getComponent(0);
int index = pane.getSelectedIndex();
tabName = pane.getTitleAt(index);
addFragment(doc,linkName,linkPath, linkDesc);
//set up a transformer
TransformerFactory …
ceyesuma -4 Posting Pro
When Using DOM can the text in <linkDesc>[url]www.deleteme.com[/url] desc</linkDesc>
be replaced or will the link element need to be
Removed and replaced?
<?xml version="1.0" encoding="utf-8"?><links>
<links>
<link action="save">
<linkName>www.deleteme.com name</linkName>
<linkPath>www.deleteme.com</linkPath>
<linkDesc>www.deleteme.com desc</linkDesc>
</link>
</links>
thanks
ceyesuma -4 Posting Pro
Hello.
I am not sure how this is supposed to work. I need to find a file that will be in
a folder data/gm in my package. If I move the program around is there a way to have the
program find its new absolute path .getAbsolutePath()
from its path
relative to the program package?
This one works but if it were on a disk on someone elses computer. What's up with that?
public final String DATASOURCEDIR="C:"+File.separator+"Users"+File.separator+"Documents"+File.separator+File.separator+"netbeans"+File.separator+"gmInstall"+File.separator+"target_gmInstall"+File.separator+"gmInstall"+File.separator+"data"+File.separator+"gm";
can I work with DATASOURCEDIR to make it work no matter where the program is?
//public final String DATASOURCEDIR = "data"+File.separator +"gm";
Thanks.
ceyesuma -4 Posting Pro
Hello.
I have the methods used to serialize and deserialize but the final JInternalFrame
re opened does not have the menu or popup menu that the original has.
Is there more I have to do to save JInternalFrames and there Actions?
Thanks
Serialize
public boolean serializeFrame(JInternalFrame frame) throws FileNotFoundException, ProfileException, LoginException,
SQLException, javax.security.auth.login.LoginException, ClassNotFoundException, InstantiationException,
IllegalAccessException {
System.out.println(key);
String M = (" --> public boolean serializeFrame("+frame.getTitle()+c+frame+") var: frame.getTitle() :name : path
:<-- \n");
System.out.println(M);
bSaved = true;
setFrame(frame);
setName(frame.getTitle());
String systemDir = SYSTEMFOLDERPATH + File.separator + name + EXT;
setFolderLocation(systemDir);
try {
FileOutputStream fo = new FileOutputStream(systemDir);
ObjectOutputStream oo = new ObjectOutputStream(fo);
oo.writeObject(frame);
oo.flush();
oo.close();
} catch (IOException e) {
bSaved = false;
System.out.println("Error- " + e.toString());
}
return bSaved;
}
deserialize Frame
public void allowOpeningOfNoteFrame(String name,String systemDir) throws FileNotFoundException, IOException,
ProfileException, LoginException, SQLException, model.err.LoginException, UnknownUserNameException,
IncorrectPasswordException, SuccessfullTargetFoldersCreation, ClassNotFoundException, InstantiationException,
IllegalAccessException, NoTargetFoldersException {
System.out.println(key);
String M = (" --> in public void allowOpeningOfNoteFrame("+name+c+systemDir+") var: xxxxxxxxx : xxxxxxxx<-- \n");
System.out.println(M);
try {
FileInputStream fis=new FileInputStream(systemDir);
ObjectInputStream ois= new ObjectInputStream(fis);
Object obj= (JInternalFrame) ois.readObject();
if(obj instanceof Object){
System.out.println(C+M+AND+" : if(obj instanceof Object) : \n ");
System.out.println(C+M+AND+obj.getClass()+c+obj+": obj.getClass()+c+obj : \n ");
}
if(obj instanceof JInternalFrame){
System.out.println(C+M+AND+obj.getClass()+": obj.getClass() : if(obj instanceof JInternalFrame){ : \n");
noteFrame=(JInternalFrame) obj;
System.out.println(C+M+AND+noteFrame.getTitle()+c+noteFrame+": noteFrame.getTitle(),noteFrame : \n");
}
fis.close();
} catch (IOException e) {
System.out.println("Error - " + e.toString());
}
System.out.println(C+M+AND+": caller \n--->: NotesAction.openSelectedFrame("+noteFrame.getTitle()+c+name+c+noteFrame
+c+systemDir+") : var: oteFrame.getTitle()+c+name+c+noteFrames <-----\n");
NotesAction.openSelectedFrame(noteFrame,name,systemDir);
System.out.println(key);
}
public void allowOpeningOfNoteFrame output
if(obj instanceof Object){
--> in public …
ceyesuma -4 Posting Pro
Hello.
I have search my app for all classes to implement java.io.Serializable. I think that
the needed classes are covered.I create and serialize JInternalFrames. When I re-open a JInternalFrame some of the JMenuItems do not do thier job. Also when I right click the Tabs on the JTabbedPane to bring up the popup menu there is no indication that there was a event. (no popup menu).
The JInternalFrames have InternalFrameListeners and the JTabbedPanes have a MouseAdapter
added when they are built. The originals work fine but if closed.The(serialized)copys don't. Is there some info on this? I tried Key words simialar to this post title.
ceyesuma -4 Posting Pro
Actually this forum is to help and guide with problems and not to do your work for you.
I did not start this post to be inhibited by your chit chat.
I am building the code if you have nothing more.
your post are of no use. I asked if someone knew of the existence of code already written
I did not ask you to write it.
/**
* Deletes a file or directory, allowing recursive directory deletion. This is an
* improved version of File.delete() method.
*/
public static boolean delete(String filePath, boolean recursive) {
File file = new File(filePath);
if (!file.exists()) {
return true;
}
if (!recursive || !file.isDirectory())
return file.delete();
String[] list = file.list();
for (int i = 0; i < list.length; i++) {
if (!delete(filePath + File.separator + list[i], true))
return false;
}
return file.delete();
}
}
ceyesuma -4 Posting Pro
I'm sure that you can use Google to search for existing code. You can write it by yourself, all the information you need is in the File class.
I did not ask for your opion apines. This forum is to find code not to stroke your ego.
Stating the obvious is not very helpful. I will have code soon that you can learn from. clearly you need this.
apines commented: Show some effort before asking people to do your work for you. -1
ceyesuma -4 Posting Pro
Does any one know where there is some Java code already written to handle deleteing directory trees? Maybe with some undo functions?
ceyesuma -4 Posting Pro
Clearly, this is beyond the scope of this forum. The answer must be in DOM. I will
need to find an XML forum.
ceyesuma -4 Posting Pro
Hello.
I going to write fames.xml with my app. I need to know the best way to handle
adding a block of XML but not at the end because I need to have the root element
at the end. Any ideas.
1.never end it but when I use it add a end element?
2.RAF?
3.find a string (</rootElement>)and append before it?
Is there a standard proceedure?
ceyesuma -4 Posting Pro
Fixed.
CLASS
CreateSystemStartFolders:
--> in public CreateSystemStartFolders() var: xxxxxxxxx : xxxxxxxx<--
: : caller
--->: setupTargetFolder(.targetFolders) : var: xxxx : xxxxxxx <-----
--> in public void setupTargetFolder(.targetFolders) var: xxxxxxxxx : xxxxxxxx<--
--> in public void sysOut() { var: xxxxxxxxx : xxxxxxxx<--
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE frames [
<!ELEMENT frames (frame)+>
<!ELEMENT frame (name,path)>
<!ATTLIST frame title CDATA #REQUIRED>
<!ELEMENT name (#PCDATA)>
<!ELEMENT path (#PCDATA)>
]>
<frames>
<frame title="frame folder">
<name>
frame folder
</name>
<path>
C:\Users\Steves_\.targetFolders\admin\admin\One Note Folder\frame folder
</path>
</frame>
</frames>
--> in public void internalFrameActivated(INTERNAL_FRAME_ACTIVATED) var: xxxxxxxxx : xxxxxxxx<--
--> in public void internalFrameActivated(INTERNAL_FRAME_ACTIVATED) var: xxxxxxxxx : xxxxxxxx<--
key
CLASS
public static class InternalFrameNotes extends JInternalFrame implements Serializable, InternalFrameListener:
CLASS
OneNoteSetupTabFrame:
--> in public void allowCreationOfOneNoteTab(tab folder) var: name : xxxxxxxx<--
: : caller
--->: SaveInitialNoteTab.firstInstance(view.SchoolJDesktopPane$InternalFrameNotes[,0,0,750x500,invalid,layout=javax.swing.plaf.basic.BasicInternalFrameUI$Handler,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.metal.MetalBorders$InternalFrameBorder@f3552f,flags=264,maximumSize=,minimumSize=,preferredSize=,closable=true,defaultCloseOperation=DISPOSE_ON_CLOSE,desktopIcon=javax.swing.JInternalFrame$JDesktopIcon[,0,0,160x31,invalid,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@122c9df,flags=8,maximumSize=,minimumSize=,preferredSize=],frameIcon=sun.swing.ImageIconUIResource@33c658,iconable=true,isClosed=false,isIcon=false,isMaximum=false,isSelected=true,maximizable=true,opened=true,resizable=true,rootPane=javax.swing.JRootPane[,5,28,740x467,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=449,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true,title=frame folder] , tab folder , C:\Users\Steves_\.targetFolders\admin\admin\One Note Folder\frame folder\tab folder) : var: frame : folderName : folderLocation <-----
--> in public void firstInstance(view.SchoolJDesktopPane$InternalFrameNotes[,0,0,750x500,invalid,layout=javax.swing.plaf.basic.BasicInternalFrameUI$Handler,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.metal.MetalBorders$InternalFrameBorder@f3552f,flags=264,maximumSize=,minimumSize=,preferredSize=,closable=true,defaultCloseOperation=DISPOSE_ON_CLOSE,desktopIcon=javax.swing.JInternalFrame$JDesktopIcon[,0,0,160x31,invalid,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@122c9df,flags=8,maximumSize=,minimumSize=,preferredSize=],frameIcon=sun.swing.ImageIconUIResource@33c658,iconable=true,isClosed=false,isIcon=false,isMaximum=false,isSelected=true,maximizable=true,opened=true,resizable=true,rootPane=javax.swing.JRootPane[,5,28,740x467,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=449,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true,title=frame folder] , tab folder : C:\Users\Steves_\.targetFolders\admin\admin\One Note Folder\frame folder\tab folder) var: frame.getTitle() :frame.getTitle() : path :<--
CLASS
public class SaveInitialNoteTab {:
--> in public void firstInstance(view.SchoolJDesktopPane$InternalFrameNotes[,0,0,750x500,invalid,layout=javax.swing.plaf.basic.BasicInternalFrameUI$Handler,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.metal.MetalBorders$InternalFrameBorder@f3552f,flags=264,maximumSize=,minimumSize=,preferredSize=,closable=true,defaultCloseOperation=DISPOSE_ON_CLOSE,desktopIcon=javax.swing.JInternalFrame$JDesktopIcon[,0,0,160x31,invalid,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@122c9df,flags=8,maximumSize=,minimumSize=,preferredSize=],frameIcon=sun.swing.ImageIconUIResource@33c658,iconable=true,isClosed=false,isIcon=false,isMaximum=false,isSelected=true,maximizable=true,opened=true,resizable=true,rootPane=javax.swing.JRootPane[,5,28,740x467,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=449,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true,title=frame folder] , tab folder : C:\Users\Steves_\.targetFolders\admin\admin\One Note Folder\frame folder\tab folder) var: frame.getTitle() :frame.getTitle() : path :<--
: C:\Users\Steves_\.targetFolders\admin\admin\One Note Folder\frame folder\tab folder: folderLocation :
CLASS
public class SaveInitialNoteTab {:
--> in public void firstInstance(view.SchoolJDesktopPane$InternalFrameNotes[,0,0,750x500,invalid,layout=javax.swing.plaf.basic.BasicInternalFrameUI$Handler,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.metal.MetalBorders$InternalFrameBorder@f3552f,flags=264,maximumSize=,minimumSize=,preferredSize=,closable=true,defaultCloseOperation=DISPOSE_ON_CLOSE,desktopIcon=javax.swing.JInternalFrame$JDesktopIcon[,0,0,160x31,invalid,layout=java.awt.BorderLayout,alignmentX=0.0,alignmentY=0.0,border=javax.swing.plaf.BorderUIResource$CompoundBorderUIResource@122c9df,flags=8,maximumSize=,minimumSize=,preferredSize=],frameIcon=sun.swing.ImageIconUIResource@33c658,iconable=true,isClosed=false,isIcon=false,isMaximum=false,isSelected=true,maximizable=true,opened=true,resizable=true,rootPane=javax.swing.JRootPane[,5,28,740x467,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=449,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true,title=frame folder] , tab folder : C:\Users\Steves_\.targetFolders\admin\admin\One Note Folder\frame folder\tab folder) var: frame.getTitle() :frame.getTitle() : path :<--
: true: bCreated target :
--> in public CreateSystemStartFolders() var: xxxxxxxxx : xxxxxxxx<--
CLASS
CreateSystemStartFolders:
--> in public CreateSystemStartFolders() var: xxxxxxxxx : …
ceyesuma -4 Posting Pro
Of course my first post makes no sense at all.
I have a program that adds frames and tabs to UI components.
Simultaneously adding folders in a dirctory.
I would like to learn how to use the program to write XML to save the paths to these folders.
first:
is this even close to a XML structure?
if so, can java write this?
further,can the blocks be added and removed and then saved?<?xml version="1.0" encoding="utf-8"?> <data> <frame> <frameName>Java Notes</frameName> <framePath>C:\user\target\Java Notes\</framePath> <tab> <tabName>Using XML</tabName> <tabPath>C:\user\target\Java Notes\Using XML\</tabPath> <doc> <docName>How to use DOM</docName> <docPath>C:\user\target\Java Notes\Using XML\How to use DOM\</docPath> </doc> <doc> <docName>How to load XML</docName> <docPath>C:\user\target\Java Notes\Using XML\How to load XML\</docPath> </doc> <tab> </frame> <frame> <frameName>Grocery List</frameName> <framePath>C:\user\target\Grocery List\</framePath> <tab> <tabName>Meals</tabName> <tabPath>C:\user\target\Grocery List\Meals</tabPath> <doc> <docName>Monday</docName> <docPath>C:\user\target\Grocery List\Meals\Monday\</docPath> </doc> <doc> <docName>Tuesday</docName> <docPath>C:\user\target\JavaNotes\Grocery List\Tuesday\</docPath> </doc> <tab> </frame> </data>
totally lost here. thanks
I ran some system out and I have the data I need for now.
I have never done an internal dtd. Can someone proof it for me?
Can I write these as .xml and then use DOM TO use them?
thanks
--> in public void sysOut() { var: xxxxxxxxx : xxxxxxxx<--
<?xml version="1.0"?>
<!DOCTYPE frameData (frameElement+) [
<!ELEMENT frameElement(frameName,framePath)>
<!ELEMENT frameElement (frameElement)*>
<!ATTLIST frameElement index NMTOKEN #REQUIRED>
<!ELEMENT frameName (#PCDATA)>
<!ELEMENT framePath (#PCDATA)>
]>
<frameData>
<frameElementindex="frame folder">
<frameNameElement>
frame folder
</frameNameElement>
<framePathElement>
C:\Users\Steves_\.targetFolders\admin\admin\One Note Folder\frame folder
</framePathElement>
</frameElement>
--> in public void sysOut() { var: xxxxxxxxx : xxxxxxxx<--
<?xml …
ceyesuma -4 Posting Pro
Hello.
Can anyone bring me up to speed to use XML to manage adding and removing tabs
from a JTabbedPane?I am adding tabs and I Would like some code or links that could show me how to
serialize any changes I make to a JTabbedPane.
Thanks
Of course my first post makes no sense at all.
I have a program that adds frames and tabs to UI components.
Simultaneously adding folders in a dirctory.
I would like to learn how to use the program to write XML to save the paths to these folders.
first:
is this even close to a XML structure?
if so, can java write this?
further,can the blocks be added and removed and then saved?
<?xml version="1.0" encoding="utf-8"?>
<data>
<frame>
<frameName>Java Notes</frameName>
<framePath>C:\user\target\Java Notes\</framePath>
<tab>
<tabName>Using XML</tabName>
<tabPath>C:\user\target\Java Notes\Using XML\</tabPath>
<doc>
<docName>How to use DOM</docName>
<docPath>C:\user\target\Java Notes\Using XML\How to use DOM\</docPath>
</doc>
<doc>
<docName>How to load XML</docName>
<docPath>C:\user\target\Java Notes\Using XML\How to load XML\</docPath>
</doc>
<tab>
</frame>
<frame>
<frameName>Grocery List</frameName>
<framePath>C:\user\target\Grocery List\</framePath>
<tab>
<tabName>Meals</tabName>
<tabPath>C:\user\target\Grocery List\Meals</tabPath>
<doc>
<docName>Monday</docName>
<docPath>C:\user\target\Grocery List\Meals\Monday\</docPath>
</doc>
<doc>
<docName>Tuesday</docName>
<docPath>C:\user\target\JavaNotes\Grocery List\Tuesday\</docPath>
</doc>
<tab>
</frame>
</data>
totally lost here. thanks
ceyesuma -4 Posting Pro
Hello
I am not sure what is getting serialized. I would like to serialize a JInternalFrame.
So what do I send my SaveFrame.java. because it puts a file "null.dat" in the folder.
I sent the frame got null.dat
sent something I thought was the class of the frame (as shown here) got null.dat
Clearly, frame is a class so I send Frame to be serialized.
create JInternalFrame
public static void createNotesInnerFrame(String ln) throws IOException, FileNotFoundException, SQLException, ProfileException, LoginException, javax.security.auth.login.LoginException, model.err.LoginException, UnknownUserNameException, IncorrectPasswordException, SuccessfullTargetFoldersCreation, ClassNotFoundException, InstantiationException, IllegalAccessException {
String M =(" --> in public static void createNotesInnerFrame("+ln+") var: ln : xxxxxxxx<-- \n");
System.out.println(M);
JPanel contentPane = new JPanel(new BorderLayout());
SetObjects so = new SetObjects();
SetObjects.setType("notes");
profile = ViewUtils.getProfile();
SetObjects.initPanelComponents();
contentPane.add(SetObjects.obj());//sets the JTabbedPane that was created on JPanel
String notes = "notes";
frame = new InternalFrameNotes(ln);
frame.add(contentPane);//puts JPanel on Frame
frame.addInternalFrameListener((InternalFrameListener) frame);
SchoolJDesktopPane.setNoteFrame(frame);
SchoolJDesktopPane.setNoteFrameName(frame.getTitle());
}//end CreateNewGuide;
serialize something
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package view.reference;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import javax.swing.JInternalFrame;
import model.err.LoginException;
import model.err.NoTargetFoldersException;
import model.err.ProfileException;
import view.ViewUtils;
/**
*
* @author Steves_
*/
public class SaveFrame {
public String instancePath;
public File target;
public boolean bExists;
public boolean bCreated;
public String folderLocation;
public String systemDir;
public String ext=".dat";
public SaveFrame() {
}
public void firstInstance(JInternalFrame frameClass, String title, String path)throws FileNotFoundException, IOException, ProfileException, LoginException {
String M =(" --> in public void firstInstance() var: …
ceyesuma -4 Posting Pro
Hello
I am not sure what is getting serialized. I would like to serialize a JInternalFrame.
So what do I send my SaveFrame.java. because it puts a file "null.dat" in the folder.
I sent the frame got null.dat
sent something I thought was the class of the frame (as shown here) got null.dat
I named the Frame and folder Java (shown in the output)
create JInternalFrame
public static void createNotesInnerFrame(String ln) throws IOException, FileNotFoundException, SQLException, ProfileException, LoginException, javax.security.auth.login.LoginException, model.err.LoginException, UnknownUserNameException, IncorrectPasswordException, SuccessfullTargetFoldersCreation, ClassNotFoundException, InstantiationException, IllegalAccessException {
String M =(" --> in public static void createNotesInnerFrame("+ln+") var: ln : xxxxxxxx<-- \n");
System.out.println(M);
JPanel contentPane = new JPanel(new BorderLayout());
SetObjects so = new SetObjects();
SetObjects.setType("notes");
profile = ViewUtils.getProfile();
SetObjects.initPanelComponents();
contentPane.add(SetObjects.obj());//sets the JTabbedPane that was created on JPanel
String notes = "notes";
frame = new InternalFrameNotes(ln);
frame.add(contentPane);//puts JPanel on Frame
frame.addInternalFrameListener((InternalFrameListener) frame);
Class<? extends JInternalFrame> frameClass=frame.getClass();
setFrameClass(frameClass);
SchoolJDesktopPane.setNoteFrame(frame);
SchoolJDesktopPane.setNoteFrameName(frame.getTitle());
}//end CreateNew
serialize something
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package view.reference;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;
import javax.swing.JInternalFrame;
import model.err.LoginException;
import model.err.NoTargetFoldersException;
import model.err.ProfileException;
import view.ViewUtils;
/**
*
* @author Steves_
*/
public class SaveFrame {
public String instancePath;
public File target;
public boolean bExists;
public boolean bCreated;
public String folderLocation;
public String systemDir;
public String ext=".dat";
public SaveFrame() {
}
public void firstInstance(Class frameClass, String title, String path) throws FileNotFoundException, IOException, ProfileException, LoginException {
String M …
ceyesuma -4 Posting Pro
In a word - yes.
You need to call JFileChoser in response to some kind of user interaction - eg clicking a menu item.
The JFileChooser returns you a File object, so you then open some kind of output Stream (eg new ObjectOutputStream) to that File, and write your data to the Stream
Thanks. I am on the right trail then. However,I have been able to collect info on
JFileChooser and Serializable but not a single example that shows them working together.
They both seem like vital operations. I wonder why there is a void in code examples.
ceyesuma -4 Posting Pro
I would like to learn how to save a JInternalFrame.
Currently reading through Serialize info.
I have never ran the app outside of Netbeans. I have had no success with creating
the jar for the app (JDesktopPane). Now Serialization is adding to the confusion.
Do I have to have the JMenuItem on the JInternalFrame to open a JFileChooser to save the
file in a Location and call a method or class to use the Streams to put it there?
Thanks
ceyesuma -4 Posting Pro
Go learn about regular expressions and the program grep. There are a lot of editors which can search for regular expressions, too. I recommend EditPad++
But this was not the error, though.
Look atINSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-01176-6','The Greatest Rock Guitar Fake Book','The Who','My Generation',277)
The semicolon is missing at the end.
Great thanks I'll look that up.
Before I leave the install post:
I started learning db's using Microsoft exess. Is the MySQL the same?
I was able to build the tables and relationships,forms and all that using a GUI with exess.
Is there a particular dl that has tools as such?
ceyesuma -4 Posting Pro
ok cool. now is that just something used in the command line?
never done a search.
The attachment preview is chopped off after the first 10 KB. Please download the entire file.
DROP DATABASE IF EXISTS splashbookdb;
CREATE DATABASE splashbookdb;
USE splashbookdb;
CREATE TABLE branch
( Branch_Number INT(4) Primary Key,
Branch_Name char(20),
Branch_Location char(20),
Number_Employees INT(4) );
INSERT INTO branch VALUES (1,'home','south_side!',1);
CREATE TABLE publisher
( Publisher_Code char(2) Primary Key,
Publisher_Name char(20),
Publisher_City char(20),
Publisher_State char(2),
Publisher_web char(20) );
INSERT INTO publisher VALUES ('HL','Hal Leonard corp.','Milwaukee','Wi','www.halleonard.com');
CREATE TABLE author
(Author_Number INT(4) Primary key,
Author_Name char(20),
Author_First char(20),
Author_Publisher char(20) );
INSERT INTO author VALUES (1,'Archer','Jeffrey','Hal Leonard corp');
CREATE TABLE book
(book_isbn char(20) Primary Key,
book_title char(100),
publisher_code char(2),
book_type char(35),
transposed char(8),
grandstaff char(3),
lead char(3),
num_pages INT(4),
book_price decimal(4,2),
paperback char(1) );
INSERT INTO book VALUES ('0-634-05315-9','Guitar Tab White Pages Vol 2','HL','ROCK','guitar','yes','no',1024,29.95,'Y');
CREATE TABLE wrote(
book_isbn char(20) PRIMARY KEY,
author_number INT(4),
sequence_number INT(4)
);
INSERT INTO wrote VALUES ('0-634-05315-9',1,1);
CREATE TABLE invent(
book_isbn char(20) PRIMARY KEY,
branch_number INT(4),
Units_on_hand INT(4),
Price decimal(2,0)
);
INSERT INTO invent VALUES ('0-634-05315-9',1,1,24.95);
CREATE TABLE content(
id INT(5) NOT NULL AUTO_INCREMENT PRIMARY KEY,
publisher_code CHAR(2),
book_isbn char(20),
book_title char(100),
artist char(150),
song char(150),
page_num INT(4)
);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Bryan adams','Its Only Love',371);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Aerosmith','Same Old Song & Dance',622);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Alice in Chains','No Excuses',513);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Asia','Heat of the Moment',268);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Chet Atkins','Galloping on the Guitar',232);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Bachman-Turner Overdrive','You Aintt Seen NothinYet',979);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','The Beach Boys','Fun,Fun,Fun',226);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','The Beach Boys','Help Me Rhonda',280);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','The Beatles','Blackbird',58);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','The Beatles','Here Comes the Sun',285);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','The Beatles','I Feel Fine',316);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','The Beatles','Yesterday',975);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Beck','Where its At',922);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Jeff Beck','Freeway Jam',211);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','The Bee Gees','Stayin Alive',747);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','George Benson','The Promised Land',548);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Black Sabbath','WarPigs (Interpolating Lukes Wall)',880);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Blink-182','Dammit',132);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Bon Jovi','In and Out of Love',343);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Booker T & The MGs','Green Onions',237);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','david bowie','Suffragette City',760);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','The Brian Setzer Orchestra','Jump, jive an Wail',381);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Brooks& Dunn', 'Boot Scootin Boogie',71);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','James Brown','I got you (I Feel Good)',319);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','The Calling','Wherever You Will Go',925);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Carter Family','Wildwood Flower',945);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','The Champs','Tequila',801);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Tracy Chapman','Fast car',195);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Cheap Trick','I Want You to Want Me',331);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Eric Clapton','I Shot the Sheriff',322);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Eic Clapton','Layla(Acoustic)',418);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Eric Clapton','Wonderful Tonight',945);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Coal Chamber','Loco',435);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','ColdPlay','Yellow',969);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Cream','White Room',934);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Crosby,Stills & Nash','Our House',531);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Deep Purple','Woman From Tokyo',948);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Default','Wasting my Time',889);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Dire Straits','Money for Nothing',479);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Eagles','Best of my Love',50);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Duane Eddy','Rebel Rouser',566);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Edgar Winter Group','Frankenstein',204);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Electric Light Orchestra','Sweet Talkin Woman',771);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Everclear','Santa Monica',629);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Extreme','More Than Words',495);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL','0-634-05315-9','Guitar Tab White Pages Vol 2','Fabulous Thunderbirds','Tuff Enough',849);
INSERT INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) VALUES ('HL
ceyesuma -4 Posting Pro
If you restore your database from a dump file the error message should tell the correct line number of this file.
Most common problems when inserting from a dump are non-escaped quotes in field content. Search for a regular expression like"'[^',]+'[^,]"
(not tested) which might find unescaped quotes in your input.
I don't know MySQL that well. I just ran my script.
Search for a regular expression
I don't understand where to search:
and "'[^',]+'[^,]"
is ^
to escape '
<-really dumb question.
I am not sure how to search .
ceyesuma -4 Posting Pro
http://dev.mysql.com/doc/refman/5.1/en/windows-installation.html
I re-installed the:mysql-essential-5.1.52-win32.msi
Thanks
Is there a indication here how to find which insert went bad? there are about 1000
to choose from.
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the right syntax to use near 'INSER
T INTO content (publisher_code,book_isbn,book_title,artist,song,page_num) V' at
line 2
ceyesuma -4 Posting Pro
Hello
Could help me get the right MySQL on my computer. I had it installed but it was a couple
years ago. My cp crashed. I can't remeber how or what to install. All I have left
is the script I used. I was running the command window one. that is fine if I new which
one to install.
thanks.
ceyesuma -4 Posting Pro
Hello.
Can anyone bring me up to speed to use XML to manage adding and removing tabs
from a JTabbedPane?I am adding tabs and I Would like some code or links that could show me how to
serialize any changes I make to a JTabbedPane.
Thanks
ceyesuma -4 Posting Pro
Uhm,
pane.addTab("New Tab Title", new JPanel());
?
Oh,well of course.
public static void insertSelectedTab() throws FileNotFoundException, IOException, SQLException, UnknownUserNameException, IncorrectPasswordException, LoginException, ProfileException, model.err.LoginException {
String M = (" --> in insertSelectedTab() var: xxxxxxxx<-- \n");
System.out.println(M);
name =OneNoteSetupTabFrame.getInsertTabName();
System.out.println(C + M + AND + name + ": CreateSystemStartFolders.getInsertTabName() : \n");
pane = getPane();
int c = pane.getTabCount();
CreateContentTabPanels gp = new CreateContentTabPanels();
pane.addTab(name, gp.noteContentTab());
pane.validate();
pane.repaint();
}
output
CLASS
OneNoteSetupTabFrame:
--> in allowCreationOfOneNoteFrame(November) var: name : xxxxxxxx<--
: insert:var insert :
--> in insertSelectedTab() var: xxxxxxxx<--
CLASS
NotesAction:
--> in insertSelectedTab() var: xxxxxxxx<--
: November: CreateSystemStartFolders.getInsertTabName() :
CLASS
OneNoteSetupTabFrame:
--> in allowCreationOfOneNoteFrame(November) var: name : xxxxxxxx<--
: insert: var insert: ; returns :
Some where in the code I create some files. Do you know how to use XML to keep track
of tabs added and the file created so I can learn serialization?
I will need to delete this tab and file too.
Thanks
output
CLASS
OneNoteSetupTabFrame:
--> in createOneNoteTab(November) var: name : <--
: : caller
--->: setupTestFolder(November) : var: xxxx : xxxxxxx <-----
--> in setupTestFolder(November) var: name : xxxxxxxx<--
--> in bExists() var: xxxxxxxxx : xxxxxxxx<--
CLASS
OneNoteSetupTabFrame:
--> in bExists() var: xxxxxxxxx : xxxxxxxx<--
: C:\Users\Steves_\.targetFolders\admin\admin\One Note Folder\Groceries\November: folderLocation :
CLASS
OneNoteSetupTabFrame:
--> in bExists() var: xxxxxxxxx : xxxxxxxx<--
: false: var bExists : returns :
CLASS
OneNoteSetupTabFrame:
--> in setupTestFolder(November) var: name : xxxxxxxx<--
: : caller
--->: allowCreationOfOneNoteTab(November) : var: name : xxxxxxx <-----
--> in allowCreationOfOneNoteFrame(November) var: name …