How to properly model a new class?

Hi all,
I need to develop a class that will read through an existing .HTML file, replace some values, and then save the result to another .HTML file. I've decided I need two methods for sure, replaceTableTags() and a generic method replaceString() to parse a specific line in the file for a value. So, now what. I create a class called HTMLFixer. I create a non-default constructor that my user instantiates to pass in things like the inputFileName and outputFileName. These become class member variables. I create an initialize() method that sets the value of the class member variables from the constructor parameters. I create an execute() method that includes a call to replaceTableTags() which includes numerous calls to replaceString(). I include a call to initialize() and execute() in the constructor so that the class does everything itself. Oh yea, class member variables to represent the BufferedReader and BufferedWriter......does any of that make sense?
Regards,
Mat

Yep.

Similar Messages

  • How do you add a new class package?

    Hi guys,
    I have just started using J2SE and I need to add a new class definition. This is to be imported at the start of the program,
    ie. import cs1.Keyboard;
    The thing im not sure of is, how do I make the compiler know where the Keyboard class is? Which directory do I have to put it in?
    If anyone has any idea, it would be really appreciated. Thanks

    Put Keyboard.class in a directory named cs1 and add the parent of cs1 to your CLASSPATH when you compile and run:
    http://java.sun.com/j2se/1.4.2/docs/tooldocs/windows/classpath.html
    MOD

  • How to properly use the new Lenovo touchpads

    I'll admit to hating Lenovo's new touchpads at first (I purchased a Thinkpad T540p for myself and a relative got an IdeaPad). It felt impossible to click with any accuracy and I was close to returning my laptop largely because of the touchpad. Then I discovered I was using it completely wrong.
    Most of us are accustomed to having dedicated physical buttons for left/middle/right clicking below the touchpad. With physical buttons, we usually had a finger on the touchpad and a thumb on the buttons. Because I was used to this style of doing things, I was trying to do that with the new touchpads: I would have my index finger sweeping around on the touchpad while my thumb was at the bottom for clicking. This led to all sorts of inaccuracies because the movement of my thumb and index finger would conflict with each other. Worse yet, when I clicked with my thumb this conflict would sometimes lead the cursor to move off of the item I was trying to click on.
    Sound familiar? After I changed how I used my touchpad, I had a much more pleasant experience.
    The thing to understand is that the new touchpads are basically a giant button. In other words, the entire touchpad surface can be used for clicking. You can press down anywhere on the touchpad and it will register as a click. Instead of keeping your thumb at the bottom of the touchpad for clicking, just use a your index finger to navigate around. When your cursor is over something you want to click, don't use your thumb! Just leave your index finger where it is and press down on the touchpad. "Click!" You don't have to use the bottom of the touchpad for clicking; the entire touchpad is one big button!
    The next logical question: how do I right-click accurately? Yes, you could use the bottom right corner for right-clicking, but there's an easier way: place two fingers (e.g. your index and middle finger on the touchpad) and then press down. "Click!" Two fingers pressed down anywhere on the surface of the touchpad (aside from the corners which have already been assigned specific functions) will register as a right click.
    Basically: just use your index finger to navigate to where you want the cursor to be, then use your index finger to press down to left-click or your index + middle finger to press down to right-click. DON'T use your thumb! It takes a little getting used to but now I completely enjoy Lenovo's new touchpad.
    Alternatively: you can also gently tap with one or two fingers on the touchpad to left and right-click respectively. A "tap" is when you touch the touchpad and lift your finger(s) without pushing the touchpad down; a "click" is when you press down on the touchpad with your finger(s) with enough force to actually move the touchpad down and make an audible "click".
    Hope this helps somebody!

    Apologies for the double post, but I've made a video demonstration of how to use the new-style touchpads for those who are visual learners: https://www.youtube.com/watch?v=vH3lpHDHaPw
    Hope it helps somebody!

  • How can i add custom attributes to a new Class Object using the API ?

    Hello everyone,
    Here is my problem. I just created a subclass of Document using the API (not XML), by creating a ClassObjectDefinition and a ClassObject. Here is the code :
    // doc is an instance of Document
    ClassObject co = doc.getClassObject();
    ClassObjectDefinition cod = new ClassObjectDefinition(ifsSession);
    cod.setSuperclass(co);
    cod.setSuperclassName(co.getName());
    cod.setName("MYDocument");
    ClassObject c = (ClassObject)ifsSession.createSchemaObject(cod);
    Everything seems to be OK since i can see the new class when i use ifsmgr. But my question is : how can i add custom attributes to this new class ? Here is what i tried :
    AttributeDefinition value = new AttributeDefinition(ifsSession);
    value.setAttribute("FOO", AttributeValue.newAttributeValue("bar"));
    c.addAttribute(value);
    But i got the following error message :
    oracle.ifs.common.IfsException: IFS-30002: Unable to create new LibraryObject
    java.sql.SQLException: ORA-01400: impossible d'insirer NULL dans ("IFSSYS"."ODM_ATTRIBUTE"."DATATYPE")
    oracle.ifs.server.S_LibraryObjectData oracle.ifs.beans.LibrarySession.DMNewSchemaObject(oracle.ifs.server.S_LibraryObjectDefinition)
    oracle.ifs.beans.SchemaObject oracle.ifs.beans.LibrarySession.NewSchemaObject(oracle.ifs.beans.SchemaObjectDefinition)
    oracle.ifs.beans.SchemaObject oracle.ifs.beans.LibrarySession.createSchemaObject(oracle.ifs.beans.SchemaObjectDefinition)
    void fr.sword.ifs.GestionDocument.IFSDocument.createDocument(java.lang.String)
    void fr.sword.ifs.GestionDocument.IFSDocument.main(java.lang.String[])
    So, what am i doing wrong ?
    More generally, are we restricted in the types of the attributes ? (for example, would it be possible to add an attribute that would be an inputStream ? Or an object that i have already created ?).
    Any help would be appreciated. Thanks in advance.
    Guillaume
    PS : i'm using Oracle iFS 1.1.9 on NT4 SP6 and Oracle 8.1.7
    null

    Hi Guillaume,
    you're welcome. Don't know exactly, but assume that ATTRIBUTEDATATYPE_UNKNOWN
    is used to check for erronous cases only
    and it shouldn't be used otherwise.
    Creating your own objects could be simply done via
    ClassObject ifsClassObject;
    DocumentDefinition ifsDocDef = new DocumentDefinition(ifsSession);
    // get class object for my very own document
    ifsClassObject = ClassObject.getClassObjectFromLabel(ifsSession, "MYDOCUMENT");
    // set the class for the document i'd like to create
    ifsDocDef.setClassObject(ifsClassObject);
    // set attributes and content for the document...
    ifsDocDef.setAttribute("MYFOO_ATTRIBUTE",....);
    ifsDocDef.setContent("This is the content of my document");
    // create the document...
    PublicObject doc = ifsSession.createPublicObject(ifsDocDef);
    null

  • How to add new class to existing DC (Web Dynpro project)

    Hi,
    How can I add new class to an existing DC (Web Dynpro project)?
    I tried adding it using File - New - Other - Java - Class, but after a build of the DC the new class (and its contents    ) was completely removed.
    Then I created a new DC (java project) and created a new class in that DC. This went fine, but I got into problems because of circular referencing between the new & the old DC, so no build was possible.
    This can't be difficult, does somebody knows how to do it?
    My temporary solution is to add the classdefinition to an exisiting .java file. Very ugly.
    Thanks,
    Jeroen

    Hi Jeroen,
    where did you create the class? If the *.java file is placed in the src/packages folder it should not be deleted by a build. (I suspect you created it in the gen_wdp folder?)
    Regards,
    Marc

  • I transferred itunes library from old PC to new PC. The content all shows when I launch iTunes on the new PC now. The previous content does not show in iTunes but folder still looks like it is on hard drive on new PC. Suggestions on how to properly merge?

    I transferred itunes library from old PC to new PC. The content all shows when I launch iTunes on the new PC now. The previous content does not show in iTunes but folder still looks like it is on hard drive on new PC. Suggestions on how to properly merge?

    Before you connect any device to a new library go to the Devices tab of the the preferences panel via Edit > Preferences (Windows) or iTunes > Preferences (Mac) and ensure the box next to Prevent iPods, iPhones, and iPads from syncing automatically is ticked. You can now safely connect the device to your computer without the danger of media being automatically deleted or overwritten.
    To get all your content off your connect your iPad to your new computer.
    Then use a 3rd party piece of software to transfer your content
    I have found Senuti useful but there are others listed in the article I linked to in a previous post.
    https://discussions.apple.com/docs/DOC-3991
    That will let you transfer your non purchased content
    For Purchased content log in to iTunes on the new computer
    In Itunes Store click on Purchased under the Quick Links section on the right.
    Download any music by clicking on the cloud button

  • How to add new class in modified template...

    Finally I have encourage myself to scratch to (for me deepest darkwood) templates...
    I have modified original Theme 2 to My theme 2 and added in some tempaltes region my parts-looks promising.
    Now I want to create sidebar region that is 450 px wide.
    It should be the same sidebar region but with different width!
    I saw on file system that there is .css so I add this class in it....(as aspected) it is not shown in template class list...
    I am able to apply that new class to template, but I cannot see that class in "Template Class" LOV (in Edit Region Template form).
    Is that important and could this bee seen in that list?
    THX!

    I have now working template with my new class...
    What is still bothering me is that I have editeted "theme_V2.css" file. I'm plannig to put my app on hosted WEB site in Germany, where this file will not be the same as is on my server.
    How to achieve future compatibilty according this?
    THX!

  • How to create a new class

    Hi,
    I'm trying to create a new class called Questions, which has
    two properties (type and condition).
    The action script is saved in the folder myComponents under
    the project.
    When I compile the Main app, I get the following error
    message:
    "1172 Definition myComponents:Question could not be found."
    Why?
    How do you call a constructor for a new class, that is not an
    extension of an existing class?
    Regards
    /Acke
    //-----------Class----------//
    package myComponents
    // Import all classes in the mx.events package
    import mx.events.*;
    public class Question {
    // Public constructor.
    public var Question(){
    // Call the constructor in the superclass.
    //super();
    // Define properties and methods.
    // Define public vars.
    public var type:string;
    public var condition:string;
    //------Main----------//
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute"
    xmlns:MyComp="myComponents.*">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.events.CloseEvent;
    import myComponents.Question;
    etc, etc....

    quote:
    Originally posted by:
    MannenMytenLegenden
    Hi,
    I'm trying to create a new class called Questions, which has
    two properties (type and condition).
    The action script is saved in the folder myComponents under
    the project.
    When I compile the Main app, I get the following error
    message:
    "1172 Definition myComponents:Question could not be found."
    Why?
    How do you call a constructor for a new class, that is not an
    extension of an existing class?
    Regards
    /Acke
    //-----------Class----------//
    package myComponents
    // Import all classes in the mx.events package
    import mx.events.*;
    public class Question {
    // Public constructor.
    public var Question(){
    // Call the constructor in the superclass.
    //super();
    // Define properties and methods.
    // Define public vars.
    public var type:string;
    public var condition:string;
    //------Main----------//
    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="
    http://www.adobe.com/2006/mxml"
    layout="absolute"
    xmlns:MyComp="myComponents.*">
    <mx:Script>
    <![CDATA[
    import mx.controls.Alert;
    import mx.events.CloseEvent;
    import myComponents.Question;
    etc, etc....
    Here is a test class I created a while back, although this
    one does extend Object it might help you out a bit with your
    constructor issue:
    package com.evilest
    import mx.controls.Alert;
    public class Testing_class extends Object
    private var message:String = new String();
    public function Testing_class(input:String) {
    this.message = input;
    public function showAlert():void {
    Alert.show(this.message, "sup");
    }

  • How to use a new class in SAP XI

    Hi @,
    I have created one new class for the purpose of exception and error handling .I dont know as to where and how i should use this class within SAP XI .How can i include this class so that the effect can be viewed during runtime
    Regards

    Hi,
    In general we will create the package and import under archieves and create USDF in mapping there , you can mention as undr import that package , in code , in UDF , you can use package.class
    see the below link for more details
    /people/alessandro.guarneri/blog/2006/01/26/throwing-smart-exceptions-in-xi-graphical-mapping
    Regards
    Chilla
    <i>reward points if it is useful..</i>

  • How can I create a new table in a MySQL database in MVC 5

    I have an MVC 5 app, which uses MySQL hosted in Azure as a data source. The point is that inside the database, I want to create a new table called "request". I have already activated migrations for my database in code. I also have the following
    code in my app.
    Request.cs: (inside Models folder)
    public class Request
    public int RequestID { get; set; }
    [Required]
    [Display(Name = "Request type")]
    public string RequestType { get; set; }
    Test.cshtml:
    @model Workfly.Models.Request
    ViewBag.Title = "Test";
    <h2>@ViewBag.Title.</h2>
    <h3>@ViewBag.Message</h3>
    @using (Html.BeginForm("SaveAndShare", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
    @Html.AntiForgeryToken()
    <h4>Create a new request.</h4>
    <hr />
    @Html.ValidationSummary("", new { @class = "text-danger" })
    <div class="form-group">
    @Html.LabelFor(m => m.RequestType, new { @class = "col-md-2 control-label" })
    <div class="col-md-10">
    @Html.TextBoxFor(m => m.RequestType, new { @class = "form-control", @id = "keywords-manual" })
    </div>
    </div>
    <div class="form-group">
    <div class="col-md-offset-2 col-md-10">
    <input type="submit" class="btn btn-default" value="Submit!" />
    </div>
    </div>
    @section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
    HomeController.cs:
    [HttpPost]
    public ActionResult SaveAndShare(Request request)
    if (ModelState.IsValid)
    var req = new Request { RequestType = request.RequestType };
    return RedirectToAction("Share");
    The point is that, I want the user to fill the form inside the Test view and click submit, and when the submit is clicked, I want a new entry in the new table to be created. But first of course I need to create the table. Should I create it using SQL query
    through MySQL workbench? If yes, then how can I connect the new table with my code? I guess I need some DB context but don't know how to do it. If someone can post some code example, I would be glad.
    UPDATE:
    I created a new class inside the Models folder and named it RequestContext.cs, and its contents can be found below:
    public class RequestContext : DbContext
    public DbSet<Request> Requests { get; set; }
    Then, I did "Add-Migration Request", and "Update-Database" commands, but still nothing. Please also note that I have a MySqlInitializer class, which looks something like this:
    public class MySqlInitializer : IDatabaseInitializer<ApplicationDbContext>
    public void InitializeDatabase(ApplicationDbContext context)
    if (!context.Database.Exists())
    // if database did not exist before - create it
    context.Database.Create();
    else
    // query to check if MigrationHistory table is present in the database
    var migrationHistoryTableExists = ((IObjectContextAdapter)context).ObjectContext.ExecuteStoreQuery<int>(
    string.Format(
    "SELECT COUNT(*) FROM information_schema.tables WHERE table_schema = '{0}' AND table_name = '__MigrationHistory'",
    // if MigrationHistory table is not there (which is the case first time we run) - create it
    if (migrationHistoryTableExists.FirstOrDefault() == 0)
    context.Database.Delete();
    context.Database.Create();

    Hello Toni,
    Thanks for posting here.
    Please refer the below mentioned links:
    http://azure.microsoft.com/en-us/documentation/articles/web-sites-dotnet-deploy-aspnet-mvc-app-membership-oauth-sql-database/
    http://social.msdn.microsoft.com/Forums/en-US/3a3584c4-f45f-4b00-b676-8d2e0f476026/tutorial-problem-deploy-a-secure-aspnet-mvc-5-app-with-membership-oauth-and-sql-database-to-a?forum=windowsazurewebsitespreview
    I hope that helps.
    Best Regards,
    Sadiqh Ahmed

  • How do you test your new laptops?

    To the gurus or people who have researched this question:  How do you test your new laptops?
    When you get a new laptop, what do you do to test it?
    My X1Carbon might arrive in a couple weeks, and reading about all the failures and DOAs is scary. So assuming mine is not simply DOA, how do you shake out the less obvious or more obscure problems?
    I did search for this info before posting. One other person asked the question, 
    >> Would appreciate advice re optimal set-up and what testing/diagnostics to do to determine if ther...
    but no one answered.

    With testing I start with the basics and work my way to the harder stuff.
    Inspect the external condition of the machine.
    Boot and enter the BIOS before Windows. Review settings then power off.
    Boot from Acronis True Image Home backup/recovery DVD and clone HDD or SSD and thus the factory image before it's ever booted to Windows.
    Boot to Windows and look carefully at the Lenovo factory image and try to get an understanding for the Lenovo software and why it is there.  This does not include the other software from Microsoft, Google, etc.
    Create Lenovo Factory Image DVD set with Rescue and Recovery.  Throw disk set in the box or put on the shelf in case the machine is ever re-sold.
    Test all of the ports - I test every port on the machine for my expected usage.  For instance, in the case of the X1 Carbon I would confirm the mini DisplayPort connection works correctly with an external LCD panel.  If the machine had a IEEE firewire port or something, test that.  Test the USB 3.0 ports with a known working external external enclosure and verify transfer speeds.
    Test the SSD speed with CrystalDiskMark, ATTO and AS Disk Benchmark software to get a good overview of the performance.
    Install HWiNFO and look carefully at the components.  Observe turbo boosting, thermals and fan RPM over the course of a few days for battery and AC power.
    Do at least one full battery discharge and recharge.  Observe the cycle and details are being properly displayed and recorded in Lenovo Power Manager.
    Download all software and drivers from support.lenovo.com for the model being tested.  Confirm visually you have all the core components needed.  Core includes the drivers, power management driver, Power Manager, hotkeys, etc.
    Flatten the machine and install Windows or Linux from scratch.  Install drivers and software.
    Re-test ports and confirm the machine is working properly.
    Benchmark the SSD again.  Confirm no change.
    Install HWiNFO and confirm turbo, thermals and fan speeds are still proper.
    Install core applications and test them.  There may be core features in Windows that also need to be installed and tested.  For instance, Windows 8 Hyper-V for virtualization. 
    Connect any external devices you expect to use and test them.  For instance, video cameras, smartphones, mp3 players, digital cameras, printers, USB docks, etc.
    Do several battery tests with your typical applications and behavior.  The goal here is to simulate how the machine will be used in your day-to-day setting or travel scenarios.  I usually do at least three tests.  This can be rather time consuming with long battery life machines so I get a lot of other testing out of the way first.
    By the time you get to this point, if you haven't hit any major roadblocks you'll start to have a good feel for the machine, and if it is going to be a keeper or not.  The assumption here is that during this timeframe you have been observing the screen, keyboard, and trackpad performance to see if it's to your liking.  The other assumption is that you are using the machine and applications in the scenarios you are purchasing it for.
    I don't run synthetic benchmarks.  I prefer to test a machine against the scenarios I expect to use it with.  I spend most of the first week making this assessment.  If any major hardware defects are present, the machine is automatically returned.  I do not repair machines just received.  No exceptions.
    Week 2 is for ironing out any minor issues and assessing if the machine meets the requirements for the scenarios it will support.  If it does, it is kept.  If it does not, it is returned.  This week includes subjective and objective input.  You have to weigh the pros and cons for a machine against your priorities. It is rare that a machine is perfect so you have to decide the ROI for the machine.  Service and Support must be considered so week two might include a call to support for any unresolved issues.  Don't discount the service you receive during this period.
    After week two, you are likely right on top of the last day to return a Lenovo machine.  The return period is 21 days from the invoice date (I believe), not the day the machine is received so make sure you are well aware of it.  After 21 days, the machine is yours for good unless you sell it.  Decision time.
    Good luck.

  • How can i mention a java class in the form's action=" ...."  in jsp

    if i am not using struts frame work, how can i call?
    i am not using any of the frame work.
    for example.
    i am searching for a customer name from a database
    i have coded the form fields in jsp
    as
    <%@page session="true"%>
    <%@page errorPage="ErrorPage.jsp"%>
    <%@page import="com.krysl.model.*"%>
    <jsp:useBean id="model" scope="session" class="com.krysl.model.webmodel"/>
    <html>
    <head>
    <title>Customer Seach</title>
    <jsp:include page="SetBaseURL.jsp" flush="false"/>
    <link rel="stylesheet" href="http://forums.sureshkumar.net/style.css">
    </head>
    <body>
    <jsp:include page="Banner.jsp" flush="false"/>
    <h1>Customer Search</h1
    <form method="POST" action=".......................">
    <b>Customer Name</b>
    <input type="TEXT" name="customerSearchArgument" size="20">
    <input type="submit" value="search">
    </form>
    </body>
    </html>
    this "customerSearchArgument" will receive a class method
    package com.krysl.controller;
    import java.io.*;
    import java.sql.SQLException;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import com.krysl.model.*;
    * @author dsdc
    public class customersearchaction extends Action
    public void run() throws ServletException, IOException
    String arg = request.getParameter("customerSearchArgument");
    if(arg != null)
    arg = arg.trim();
    if(!arg.equals(""))
    try
    model.customerSearch(arg);
    catch(SQLException e)
    throw new ServletException(e.getMessage());
    final String next = "/CustomersList.jsp";
    RequestDispatcher rd = application.getRequestDispatcher(next);
    if(rd == null)
    throw new ServletException("Could not find" + next);
    rd.forward(request, response);
    All other database connections and related things i coded in
    some other classes webmodel, model, controller servlets etc....
    in the above class the model.customerseach(arg);
    will do all the searching.
    my doubt is how to call this method in that action="" of jsp
    i tried as action="com.krysl.model.customersearch"
    action="com/krysl/model/customersearch"
    its not working
    please letme kno
    urget
    thank you

    Hi.
    go to otn.oracle.com/products/forms and get infromation about PJC and JavaBeans in Forms. The keyfilter example is available as sample as well. However, the link temporarily doesn't work
    All Forms demos and code sources: http://download.oracle.com/otndocs/demos/Forms_Demos_10gr2.zip
    Frank

  • Old globals with new classes

    Please forgive my ignorance:
    I'm porting some old illustrator sdk code into the illustrator cs5 sdk.  I plan on making this a hybrid plugin where the UI is built in flash builder.  I am using the FreeGrid sample as a model.
    My old code is based in the old "shell" model, where in there is a file called common.h which contains a the line "extern Globals *g;".
    I was able to keep use these globals to store some preferences for the life of the plug-in.
    Is there a way to achieve this using the new class model.  I tried to declare a public member variable in the FreeGridPlugin class called "selected".  Then I added a pointer to FreeGridPlugin instance as a member of the FreeGridDialogControler class.  But when I try to access the FreeGridPlugin methods from the FreeGridDialogControler methods I get the error "bool FreeGridPlugin::selected is private within this context".  I can't figure out what I'm doing wrong of if there's a better way to go about this, but really need to be able set edit some variables whether from the dialog controler and from elsewhere.  How can I have these variables persist, and not go away as instances of classes are created and deleted?
    Or am I just completely backwards on all this?
    Any help would be MUCH appreciated.  Thanks.

    I know almost nothing about any of the Flash stuff, so take this with a grain of salt -- but if you're having trouble with things going away when the plugin reloads & unloads, have you tried making it persistent? I.e., make sure it never unloads? We avoid all that crap about the VTABLE fix and such by just making sure MAPublisher is in memory, all the time. You do that by doing this:
    SPAccessRef m_pluginAccess = 0;
    AIErr error = sSPAccess->AcquirePlugin(GetPluginRef(), &m_pluginAccess);
    (you can get the plugin ref in any message, so StartUp will have one)
    Just call
    AIErr error = sSPAccess->ReleasePlugin(m_pluginAccess);
    in the ShutdownPlugin message

  • How to reference the WindowListener in "class implements WindowListener"

    i need to remove a WindowListener but i dont know how to
    reference Listeners implented by classes.
    Thanks for any help in advance!
    public class MyClass implements WindowListener{
    public MyClass(){
    frame.addWindowListener(this);
    public static void RemoveIt(){
    frame.removeWindowListener( ??? )
    JFrame frame = new JFrame();
    }

    Looks like im just going to have to implement this
    all much differently -
    and maybe in a less lazy manner, haha.Hi! Sorry for my late reply.
    Let me help you a little;
    ===============================================================
    1.) You can create a class that will be shared by each of your frame.
    ===============================================================
    The shared class will contain the following:
    1.) The number of your alive frame.
    2.) The information of your alive frame. ie. name, if it is the main, etc.
    Then your frame should look at that shared class so that it will know when to
    invoke System.exit(int);
    ===============================================================
    2.) You can use java.util.prefs.Preferences
    ===============================================================
    Use preference to put and get information about your frame.
    ===============================================================
    3.) You can extends my class below.
    ===============================================================
    NOTE: This example may or may not help the OP. I'm sorry.
    * @(#)AbstractExitableJFrame.java     05/06/25
    * 2005 Tunay na pag-aari ni Ronillo Ang.
    package com.yahoo.ronilloang.cswingx;
    import java.awt.GraphicsConfiguration;
    import java.awt.event.WindowEvent;
    import java.awt.event.WindowFocusListener;
    import java.awt.event.WindowListener;
    import java.awt.event.WindowStateListener;
    import javax.swing.JFrame;
    * Use this at your own risks.
    * @version     1.4.2
    * @author     Ronillo Ang
    public abstract class AbstractExitableJFrame extends JFrame implements WindowFocusListener, WindowListener, WindowStateListener{
         private static int frameCount = 0; // how many are we?
          * @see          javax.swing.JFrame constructor.
         public AbstractExitableJFrame(){
              super();
              ++frameCount;
          * @see          javax.swing.JFrame constructor.
         public AbstractExitableJFrame(GraphicsConfiguration gc){
              super(gc);
              ++frameCount;
          * @see          javax.swing.JFrame constructor.
         public AbstractExitableJFrame(String title){
              super(title);
              ++frameCount;
          * @see          javax.swing.JFrame constructor.
         public AbstractExitableJFrame(String title, GraphicsConfiguration gc){
              super(title, gc);
              ++frameCount;
          * Called by the constructors to init the <code>AbstractExitableJFrame</code> properly.
         protected final void frameInit(){
              super.frameInit();
              addWindowFocusListener(this);
              addWindowListener(this);
              addWindowStateListener(this);
         public final void windowGainedFocus(WindowEvent we){
              exitableJFrameGainedFocus(we);
         public final void windowLostFocus(WindowEvent we){
              exitableJFrameLostFocus(we);
         public final void windowActivated(WindowEvent we){
              exitableJFrameActivated(we);
         public final void windowClosed(WindowEvent we){
              exitableJFrameClosed(we);
              --frameCount;
              if(frameCount <= 0 || isMain())
                   System.exit(0);
         public final void windowClosing(WindowEvent we){
              exitableJFrameClosing(we);
         public final void windowDeactivated(WindowEvent we){
              exitableJFrameDeactivated(we);
         public final void windowDeiconified(WindowEvent we){
              exitableJFrameDeiconified(we);
         public final void windowIconified(WindowEvent we){
              exitableJFrameIconified(we);
         public final void windowOpened(WindowEvent we){
              exitableJFrameOpened(we);
         public final void windowStateChanged(WindowEvent we){
              exitableJFrameStateChanged(we);
          * Invoked when {@link #windowGainedFocus(WindowEvent)} is invoked.
         public abstract void exitableJFrameGainedFocus(WindowEvent we);
          * Invoked when {@link #windowLostFocus(WindowEvent)} is invoked.
         public abstract void exitableJFrameLostFocus(WindowEvent we);
          * Invoked when {@link #windowActivated(WindowEvent)} is invoked.
         public abstract void exitableJFrameActivated(WindowEvent we);
          * Invoked when {@link #windowClosed(WindowEvent)} is invoked.
         public abstract void exitableJFrameClosed(WindowEvent we);
          * Invoked when {@link #windowClosing(WindowEvent)} is invoked.
         public abstract void exitableJFrameClosing(WindowEvent we);
          * Invoked when {@link #windowDeactivated(WindowEvent)} is invoked.
         public abstract void exitableJFrameDeactivated(WindowEvent we);
          * Invoked when {@link #windowDeiconified(WindowEvent)} is invoked.
         public abstract void exitableJFrameDeiconified(WindowEvent we);
          * Invoked when {@link #windowIconified(WindowEvent)} is invoked.
         public abstract void exitableJFrameIconified(WindowEvent we);
          * Invoked when {@link #windowOpened(WindowEvent)} is invoked.
         public abstract void exitableJFrameOpened(WindowEvent we);
          * Invoked when {@link #windowStateChanged(WindowEvent)} is invoked.
         public abstract void exitableJFrameStateChanged(WindowEvent we);
          * Tests if this frame is the main frame.
         public abstract boolean isMain();
    Take care and God bless you all. Thank you. -Ronillo

  • How to add support for new file type.

    Using the ESDK, I would like to add support for new file type ( a new extension). this new extension will function like any other non visual code editor but will have specific syntax highlighting, code folding and explorer.
    I am trying ot figure out if I need to create a new editor or use existing JDeveloper code editor and add support for new file type. Does anyone have a high level outline on how to do this using the ESDK that is specifically targeted at adding new file type support for a text based code editor?
    I have looked at the Samples and keep going in multipe directions. It would be cool if there was an example that was how add syntax higlighting for new file type.
    Thank you

    Brian, thank you. I looked at this extension and it answered a lot of questions for me. I was going in the right direction but needed a little help and bost of confidence, this is just what I needed. I created the LanguageSupport, LanguageModel, Addin, Node and TextDocument that are specific to the new file type. I was getting hung up on how to hook this into the JDevelpoer editor. I keep thinking I have to create a custom editor but it looks like I don't have to and it looks like I can associate this file support with the editor framwork, for version 10.1.3.2, with the following in the Addin Initilize() method.
    Recognizer.mapExtensionToClass(MY_EXTENSION, MyNode.class);
    CodeEditor.registerNodeType(MyNode.class, MY_EXTENSION);
    LanguageModule.registerModuleForFileType(new MyLanguageModule(), MY_EXTENSION);
    I have done this but still not able to recognize the new file type.
    At this point, I just want to be able to recognize the new file and display it's associated icon or display a messare to the message log. I put a System.out.println("test") in the Initilize() method of my addin. then I registered MyAddin in the extension.xml. JDeveloper sees this new extension and it is loaded but I have not been able to show the test message or display the new icon when I open the new file type.
    extension.xml
    <?xml version="1.0" encoding="windows-1252" ?>
    <extension xmlns="http://jcp.org/jsr/198/extension-manifest"
               id="teisaacs.jdev.myext.MyAddin" version="1.0.0" esdk-version="1.0"
               rsbundle-class="teisaacs.jdev.myext.resources.MyResBundle">
        <name rskey="EXTENSION_NAME">My Code Editor</name>
        <owner rskey="EXTENSION_OWNER">Me</owner>
        <dependencies>
            <import version="10.1.3">oracle.jdeveloper</import>
        </dependencies>
        <hooks>
            <jdeveloper-hook>
                <addins>
                    <addin>teisaacs.jdev.myext.MyEditorAddin</addin>
                </addins>
            </jdeveloper-hook>
            <feature-hook>
                <description>My Code Editor</description>
                <optional>true</optional>
            </feature-hook>
            <document-hook>
                <documents>
                    <by-suffix document-class="teisaacs.jdev.myext.model.MySourceDocument">
                        <suffix>my</suffix>
                        <suffix>MY</suffix>
                    </by-suffix>
                </documents>
            </document-hook>
            <editor-hook>
                <editors>
                    <editor editor-class="teisaacs.jdev.myext.editor.MyEditor">
                        <name rskey="EXTENSION_NAME">My Editor</name>
                    </editor>
                    <mappings>
                        <mapping document-class='teisaacs.jdev.myext.model.MySourceDocument">         
                            <open-with editor-class="teisaacs.jdev.myrext.editor.MyEditor"
                                       preferred="true"/>
                            <open-with editor-class="javax.ide.editor.CodeEditor"/>
                        </mapping>
                    </mappings>
                </editors>
            </editor-hook>
        </hooks>
    </extension>
    public class MyAddin implements Addin {
        public static final String MY_EXTENSION = "my";
        public void initialize() {
            System.out.println("MyEditor Constructor");
            new MyLanguageModule();
            Recognizer.mapExtensionToClass(MY_EXTENSION, MyNode.class);
            CodeEditor.registerNodeType(MyNode.class, MY_EXTENSION);
            LanguageModule.registerModuleForFileType(new MyLanguageModule(), MY_EXTENSION);
    }I have added and removed the editor hook along with many other modificaitons to the extension.xml but still not recognizing the new file extension.
    Todd

Maybe you are looking for

  • AX resets wireless connection to "require a certificate"

    I've established connection but, apparently, the Airport Utility resets my wireless network to require a certificate and can't "validate identity" something my Linksys wireless is not set up to do. Is there a Utility setting that does not require or

  • Can I run logic pro x on iMac 2.8Ghz core 2 duo, 4GB RAM?

    I currently run Logic Pro 9 (9.1.8) on my iMac (early 2008 model as above) but really like the look of pro x features, will it run on my iMac? Thanks Tim

  • D5503 touchscreen display loses pressing

    Hello, I have Xperia Z1 Compact Black D5503 for 5 days. I like it, but i have a problem with touchscreen. When i press the screen and start drawing or swiping something(continuous touch) - it randomly losses my touches. For example in Xperia Diagnost

  • Edit Library Image  in Photoshop Elements

    It seems to be a hit or miss problem with updating images in Captivate Library. I am retrofitting files some one else created. I use Edit with... option and open in Photoshop Elements Edit exe. The edits in Photoshop goes as planned. I use Save from

  • In what order do you adjust?

    I usually do: Exposure White Balance Enhance (Saturation/Contrast) Straighten Crop Sharp/Edge Sharp This is my order if needed. If I need Highlights/Shadows I will squeeze it in, then deselect it. This works best/fastest for me. Cheers. Message was e