Can't change Text2D's String!

Hey guys,
I've got a 2D score board I'd like to update frequently (using 2D to save some FPS instead of Text3D) but I can't manage to change the String dynamicly: I can change the String to another String with the exact same with or less, but if less, the String is S T R E C H E D across the original 3D plane in an ugly way. I tried creating a new TexT2D bigger than what I needed and then set a shorter String in it, same stretching problem...
Has anyone resolved this? What's the point of having a setString method if you can only set Strings which are the exact same width?! Btw, Text3D automatically handles the change since we're dealing with completly different geometries everytime. Maybe I have to manually setGeometry of the next String to match that String's width? If so, how do I calculate that width?
Thanks!
Btw, here's the code I use to get the proper capabilities and get rid of the 3 billion error messages I got!
highScoreNbr = new Text2D(Long.toString(highScore), COLOR_WHITE, FONT_NAME, FONT_SIZE, FONT_STYLE);
highScoreNbr.setCapability(Text2D.ALLOW_APPEARANCE_READ);
highScoreNbr.setCapability(Text2D.ALLOW_APPEARANCE_WRITE);
highScoreNbr.getAppearance().setCapability(Appearance.ALLOW_TEXTURE_READ);
highScoreNbr.getAppearance().setCapability(Appearance.ALLOW_TEXTURE_WRITE);
highScoreNbr.getAppearance().getTexture().setCapability(Texture.ALLOW_IMAGE_READ);
highScoreNbr.getAppearance().getTexture().setCapability(Texture.ALLOW_IMAGE_WRITE);

Hi,
there's a bug in java3d 1.3:
http://developer.java.sun.com/developer/bugParade/bugs/4809249.html
My workaround: download java3d 1.2x (SDK) and extract the sourcecode for class Text2D. Then rewrite the code (rename the class) to a new class like MyText2D and use it instead of Text2D.
Regards,
Oliver

Similar Messages

  • Can we change data in string object.

    Can we change data in string object.

    Saw this hack to access the char[]'s in a String in another thread. Beware that the effects of doing this is possible errors, like incorrect hashCode etc.
    import java.lang.reflect.*;
    public class SharedString {
            public static Constructor stringWrap = null;
            public static String wrap(char[] value, int offset, int length) {
                    try {
                            if (stringWrap == null) {
                                    stringWrap = String.class.getDeclaredConstructor(new Class[] { Integer.TYPE, Integer.TYPE, char[].class });
                                    stringWrap.setAccessible(true);
                            return (String)stringWrap.newInstance(new Object[] { new Integer(offset), new Integer(length), value });
                    catch (java.lang.NoSuchMethodException e) {
                            System.err.println ("NoMethod exception caught: " + e);
                    catch (java.lang.IllegalAccessException e) {
                            System.err.println ("Access exception caught: " + e);
                    catch (java.lang.InstantiationException e) {
                            System.err.println ("Instantiation exception caught: " + e);
                    catch (java.lang.reflect.InvocationTargetException e) {
                            System.err.println ("Invocation exception caught: " + e);
                    return null;
            public static void main(String[] args) {
                    char[] chars = new char[] { 'l', 'e', 'v', 'i', '_', 'h' };
                    String test = SharedString.wrap(chars, 0, chars.length);
                    System.out.println("String test = " + test);
                    chars[0] = 'k';
                    chars[1] = 'a';
                    chars[2] = 'l';
                    chars[3] = 'l';
                    chars[4] = 'a';
                    chars[5] = 'n';
                    System.out.println("String test = " + test);
    } Gil

  • Can't change the connection string of SSIS package with derived columns?

    We upgraded SQL server 2008 to 2012, copied and converted all SSIS packages from Visual Studio 2008 to 2010.  When I opened a package in VS 2010 and tried to change the connection string, in the local connection managers, if the data source is another
    SSIS package B(.dtsx file) with derived columns, I can't change the connection string of package B. When I opened the file connection manager editor for package B and tried to locate a dtsx file in another location, saved the change, reopened the project.
    Package B still pointed to previous file.  Other packages without derived columns work fine. Any thoughts?

    We are using the package deployment model and refer to other packages in the same project. If
    we changed the path of package B (with derived columns) to "D:\Visual Studio 2010\xxxx", and refer it in package A, in the A's connection manager, the connection string of package B is still its previous location  "D:\Visual
    Studio 2008\xxxx". When we ran the package A in the SQL server agent, the data source is still
     "D:\Visual
    Studio 2008\xxxx", so how can I change it to "D:\Visual
    Studio 2010\xxxx"? Why has the package C (without derived columns) no such problem? thanks.

  • Problem with Connection Manager. Can't change connection string / Server name

    p.MsoNormal, li.MsoNormal, div.MsoNormal
    {margin-top:0cm;margin-right:0cm;margin-bottom:10.0pt;margin-left:0cm;line-height:115%;font-size:11.0pt;font-family:'Calibri','sans-serif';}
    .MsoChpDefault
    {font-size:10.0pt;}
    .MsoPapDefault
    {line-height:115%;}
    @page Section1
    {size:612.0pt 792.0pt;margin:72.0pt 72.0pt 72.0pt 72.0pt;}
    div.Section1
    {page:Section1;}
    Hi,
    I have copied a number of SSID packages from a live server to my test server and am trying to get them up and running but I have a problem with the connection. The only thing that is different is the server name. I decided to keep the same connection in the connection manager as it is referenced in a dtsConfig file. I changed the dtsConfig file to reference the new servername [Data Source= new test server name]. I also check my paths and they are pointing to the correct config locations etc.
    I found this post which was similar to my problem but I still get problems with the connection
    http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1319961&SiteID=1
    I updated the connection by changing the server name in the actual connection. I did this from the data flow tab in the Connection Managers sections (MS Visual Studio). Right clicked - Edit - changed the name of the server name to my test server and selected the database. Test connection was fine, and saved this.
    Once I saved this, the connection string changed to my current test server in the properties of the connection. However when I run the package I get the following error:
    Error: 0xC0202009 at ReportsImport, Connection manager "myconnectionstring": SSIS Error Code DTS_E_OLEDBERROR.  An OLE DB error has occurred. Error code: 0x80004005.
    An OLE DB record is available.  Source: "Microsoft SQL Native Client"  Hresult: 0x80004005  Description: "Login timeout expired".
    An OLE DB record is available.  Source: "Microsoft SQL Native Client"  Hresult: 0x80004005  Description: "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.".
    An OLE DB record is available.  Source: "Microsoft SQL Native Client"  Hresult: 0x80004005  Description: "Named Pipes Provider: Could not open a connection to SQL Server [53]. ".
    Error: 0xC020801C at Myprocess import from file, BuyAtReportsImport [79]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "myconnectionstring" failed with error code 0xC0202009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.
    Error: 0xC0047017 at Myprocess import from file, DTS.Pipeline: component "ReportsImport" (79) failed validation and returned error code 0xC020801C.
    Error: 0xC004700C at Myprocess import from file, DTS.Pipeline: One or more component failed validation.
    Error: 0xC0024107 at Myprocess import from file: There were errors during task validation.
    So even if I change the existing connection properties and save and Build my package again, my connection properties (connectionstring, servername etc) all revert back to its original data source when I re-open the package. Simply it does not seem to be saving the connection properties i put in.
    What am I doing wrong or how can I change the existing connection manager to look at the new server. The database is  the same and I have full admin privilege on the server.
    I don't want to recreate my packages as there are alot and they are not simple.
    After changing the connection properties, saving and reloading I get a connection error. But this is because it is not retaining the new connection manger setting i entered.
    Incidentally - I created a new SSID to perform a simple connection and write to the the server and it was OK so there is no problem with actually seeing the my test server.
    Thanks in advance

    Yes, the package is in visual studio and I have executed it. There are no errors but in the output i have the error message about my connection. My dtsConfig file is added to the project in the 'Package Configuration Organizer' and path and files are correct. This is the output error:
    Error: 0xC020801C at xx import from file, xxReportsImport [79]: SSIS Error Code DTS_E_CANNOTACQUIRECONNECTIONFROMCONNECTIONMANAGER.  The AcquireConnection method call to the connection manager "myconnectionname" failed with error code 0xC0202009.  There may be error messages posted before this with more information on why the AcquireConnection method call failed.
    I will try and run it using dtexec.exe. if I have two config files do i use
    dtsexec.exe /f <packagename> /conf <configfile> /conf <secondconfigfile>

  • Can't change string variable values in Flash CS4 Debugger

    I'm using the Flash CS4 debugger, and while I can change numeric variable values in the Variables panel, I can't change string variable values. The only characters the fields accept are the numbers 1-9 and the characters "d" and "j".
    I can  paste strings  into the value fields, but that's a bit of a pain. I've tried this on a couple of different Flash CS4 installations and get the same results.
    Does anyone know if it's possible to change string values in the Variables panel of the Flash CS4 Debugger?

    See:
    http://forum.java.sun.com/thread.jspa?threadID=591012&tstart=15

  • I can call other people on facetime and reach them but if they call me it doesn't ring.  What do I change I my strings to get it to ring.  If they call me first, I can see the call coming in and accept it but it doesn't ring.

    I can call other people on facetime and reach them but if they call me it doesn't ring.  What do I change I my strings to get it to ring.  If they call me first, I can see the call coming in and accept it but it doesn't ring.

    see wemweb answer here:
    https://discussions.apple.com/message/19087457#19087457
    you'll also see answers to your question in the "More like this" box on the right

  • How can I change the name of item in TableViewController iOS

    How can I change the name of item in TableViewController? I want to be able to change the title of an item if I added one. Code:
    //  ViewController.m
    //  Movie List
    //  Created by Damian on 20/02/15.
    //  Copyright (c) 2015 Tika Software. All rights reserved.
    #import "ViewController.h"
    @interface ViewController ()
    These outlets to the buttons use a `strong` reference instead of `weak` because we want
    to keep the buttons around even if they're not inside a view.
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *editButton;
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *cancelButton;
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *deleteButton;
    @property (nonatomic, strong) IBOutlet UIBarButtonItem *addButton;
    // A simple array of strings for the data model.
    @property (nonatomic, strong) NSMutableArray *dataArray;
    @end
    #pragma mark -
    @implementation ViewController
    - (void)viewDidLoad
        [super viewDidLoad];
         This option is also selected in the storyboard. Usually it is better to configure a table view in a xib/storyboard, but we're redundantly configuring this in code to demonstrate how to do that.
        self.tableView.allowsMultipleSelectionDuringEditing = YES;
        // populate the data array with some example objects
        self.dataArray = [NSMutableArray new];
        NSString *itemFormatString = NSLocalizedString(@"Movie %d", @"Format string for item");
        for (unsigned int itemNumber = 1; itemNumber <= 0; itemNumber++)
            NSString *itemName = [NSString stringWithFormat:itemFormatString, itemNumber];
            [self.dataArray addObject:itemName];
        // make our view consistent
        [self updateButtonsToMatchTableState];
    #pragma mark - UITableViewDelegate
    - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
        return self.dataArray.count;
    - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
        // Update the delete button's title based on how many items are selected.
        [self updateDeleteButtonTitle];
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
        // Update the delete button's title based on how many items are selected.
        [self updateButtonsToMatchTableState];
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
        // Configure a cell to show the corresponding string from the array.
        static NSString *kCellID = @"cellID";
        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:kCellID];
        cell.textLabel.text = [self.dataArray objectAtIndex:indexPath.row];
        return cell;
    #pragma mark - Action methods
    - (IBAction)editAction:(id)sender
        [self.tableView setEditing:YES animated:YES];
        [self updateButtonsToMatchTableState];
    - (IBAction)cancelAction:(id)sender
        [self.tableView setEditing:NO animated:YES];
        [self updateButtonsToMatchTableState];
    - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
        // The user tapped one of the OK/Cancel buttons.
        if (buttonIndex == 0)
            // Delete what the user selected.
            NSArray *selectedRows = [self.tableView indexPathsForSelectedRows];
            BOOL deleteSpecificRows = selectedRows.count > 0;
            if (deleteSpecificRows)
                // Build an NSIndexSet of all the objects to delete, so they can all be removed at once.
                NSMutableIndexSet *indicesOfItemsToDelete = [NSMutableIndexSet new];
                for (NSIndexPath *selectionIndex in selectedRows)
                    [indicesOfItemsToDelete addIndex:selectionIndex.row];
                // Delete the objects from our data model.
                [self.dataArray removeObjectsAtIndexes:indicesOfItemsToDelete];
                // Tell the tableView that we deleted the objects
                [self.tableView deleteRowsAtIndexPaths:selectedRows withRowAnimation:UITableViewRowAnimationAutomatic];
            else
                // Delete everything, delete the objects from our data model.
                [self.dataArray removeAllObjects];
                // Tell the tableView that we deleted the objects.
                // Because we are deleting all the rows, just reload the current table section
                [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationAutomatic];
            // Exit editing mode after the deletion.
            [self.tableView setEditing:NO animated:YES];
            [self updateButtonsToMatchTableState];
    - (IBAction)deleteAction:(id)sender
        // Open a dialog with just an OK button.
        NSString *actionTitle;
        if (([[self.tableView indexPathsForSelectedRows] count] == 1)) {
            actionTitle = NSLocalizedString(@"Are you sure you want to remove this movie?", @"");
        else
            actionTitle = NSLocalizedString(@"Are you sure you want to remove these movies?", @"");
        NSString *cancelTitle = NSLocalizedString(@"Cancel", @"Cancel title for item removal action");
        NSString *okTitle = NSLocalizedString(@"OK", @"OK title for item removal action");
        UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:actionTitle
                                                                 delegate:self
                                                        cancelButtonTitle:cancelTitle
                                                   destructiveButtonTitle:okTitle
                                                        otherButtonTitles:nil];
        actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
        // Show from our table view (pops up in the middle of the table).
        [actionSheet showInView:self.view];
    - (IBAction)addAction:(id)sender
        [self.dataArray addObject:@"New Movie"];
        // Tell the tableView about the item that was added.
        NSIndexPath *indexPathOfNewItem = [NSIndexPath indexPathForRowself.dataArray.count - 1) inSection:0];
        [self.tableView insertRowsAtIndexPaths:@[indexPathOfNewItem]
                              withRowAnimation:UITableViewRowAnimationAutomatic];
        // Tell the tableView we have finished adding or removing items.
        [self.tableView endUpdates];
        // Scroll the tableView so the new item is visible
        [self.tableView scrollToRowAtIndexPath:indexPathOfNewItem
                              atScrollPosition:UITableViewScrollPositionBottom
                                      animated:YES];
        // Update the buttons if we need to.
        [self updateButtonsToMatchTableState];
    #pragma mark - Updating button state
    - (void)updateButtonsToMatchTableState
        if (self.tableView.editing)
            // Show the option to cancel the edit.
            self.navigationItem.rightBarButtonItem = self.cancelButton;
            [self updateDeleteButtonTitle];
            // Show the delete button.
            self.navigationItem.leftBarButtonItem = self.deleteButton;
        else
            // Not in editing mode.
            self.navigationItem.leftBarButtonItem = self.addButton;
            // Show the edit button, but disable the edit button if there's nothing to edit.
            if (self.dataArray.count > 0)
                self.editButton.enabled = YES;
            else
                self.editButton.enabled = NO;
            self.navigationItem.rightBarButtonItem = self.editButton;
    - (void)updateDeleteButtonTitle
        // Update the delete button's title, based on how many items are selected
        NSArray *selectedRows = [self.tableView indexPathsForSelectedRows];
        BOOL allItemsAreSelected = selectedRows.count == self.dataArray.count;
        BOOL noItemsAreSelected = selectedRows.count == 0;
        if (allItemsAreSelected || noItemsAreSelected)
            self.deleteButton.title = NSLocalizedString(@"Delete All", @"");
        else
            NSString *titleFormatString =
            NSLocalizedString(@"Delete (%d)", @"Title for delete button with placeholder for number");
            self.deleteButton.title = [NSString stringWithFormat:titleFormatString, selectedRows.count];
    @end

    Hey JB001,
    Sounds like you have more going on than just a simple issue with Home Sharing and more dealing with Wi-Fi syncing. Start with the article below and see if that may resolve it.
    iTunes 10.5 and later: Troubleshooting iTunes Wi-Fi syncing
    http://support.apple.com/kb/TS4062
    If it does not work out, then may I suggest contacting Apple for further assistance to walk you through it or just take that time that you were talking about to sort it out.
    Contact Apple Support
    https://getsupport.apple.com/GetproductgroupList.action
    Regards,
    -Norm G.

  • How can I change the view of Download Folder in Dock

    I used to have my Download Folder in my Dock show up as a vertical string of icons with the latest at the bottom, when I clicked on the Folder. I recently had to drag the Downloads Folder back into the Dock after it had disappeared from there.  After doing that I now notice when I click on the Downloads icon in the Dock, it now shows up as a page full of icons.  I prefer the original vertical listing.  How can I change it back?
    Hope someone can help on this one.  Thanks.

    That's not an option. Under Display As, you have the view options for Downloads

  • How can I change excel column header using Labile.

    Dear Experts,
                          How can i change excel column header using LabVIEW.
    Thanks for any and all help!
    M.S.Sivaraj.
    Sivaraj M.S
    CLD

    As I said in my previous post, column headers in Excel are merely row 1 cells. May be I missing something here, so please be more explicit with your question.
    I guess you are using the Excel Report tools, and you want to modify an existing sheet. From my limited experience with the Excel Report tools, it is not possible to open an existing woorkbook (except as template...), so the answer to your question should be "Forget it"...
    The work around is to use the example I pointed for you before, and either to write the whole new colum headers as a string array, starting in A1, or to write a single string to a given cell in row 1.
    Hope this helps 
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • How Can I replace newScale Text Strings with Custom Values?

    How Can I replace newScale Text Strings with Custom Values?
    How can I replace newScale text strings with custom values?
    All  newScale text is customizable. Follow the procedure below to change the  value of any text string that appears in RequestCenter online pages.
    Procedure
    1. Find out the String ID of the text string you would like to overwrite by turning on the String ID display:
    a) Navigate to the RequestCenter.ear/config directory.
    b) Open the newscale.properties file and add the following name-value pair at the end of the file:res.format=2
    c) Save the file.
    d) Repeat steps b and c for the RmiConfig.prop and RequestCenter.prop files.
    e) Stop and restart the RequestCenter service.
    f) Log  in to RequestCenter and browse to the page that has the text you want  to overwrite. In front of the text you will now see the String ID.
    g) Note down the String ID's you want to change.
    2. Navigate to the directory: /RequestCenter.ear/RequestCenter.war/WEB-INF/classes/com/newscale/bfw.
    3. Create the following sub-directory: res/resources
    4. Create the following empty text files in the directory you just created:
    RequestCenter_0.properties
    RequestCenter_1.properties
    RequestCenter_2.properties
    RequestCenter_3.properties
    RequestCenter_4.properties
    RequestCenter_5.properties
    RequestCenter_6.properties
    RequestCenter_7.properties
    5. Add the custom text strings to the appropriate  RequestCenter_<Number>.properties file in the following manner  (name-value pair) StringID=YourCustomTextString
    Example: The StringID for "Available Work" in ServiceManager is 699.
    If you wanted to change "Available Work" to "General Inbox", you  would add the following line to the RequestCenter_0.properties file
         699=General Inbox
    Strings are divided into the following files, based on their numeric ID:
    Strings are divided into the following files, based on their numeric ID:
    String ID  File Name
    0 to 999 -> RequestCenter_0.properties
    1000 to 1999 -> RequestCenter_1.properties
    2000 to 2999 -> RequestCenter_2.properties
    3000 to 3999 -> RequestCenter_3.properties
    4000 to 4999 -> RequestCenter_4.properties
    5000 to 5999 -> RequestCenter_5.properties
    6000 to 6999 -> RequestCenter_6.properties
    7000 to 7999 -> RequestCenter_7.properties
    6. Turn off the String ID display by removing (or commenting out) the line "res.format=2" from the newscale.properties, RequestCenter.prop and RmiConfig.prop files
    7. Restart RequestCenter.
    Your customized text should be displayed.

    I've recently come across this information and it was very helpful in changing some of the inline text.
    However, one place that seemed out of reach with this method was the three main buttons on an "Order" page.  Specifically the "Add & Review Order" button was confusing some of our users.
    Through the use of JavaScript we were able to modify the label of this button.  We placed JS in the footer.html file that changes the value of the butt

  • HOw can i change the color of a cell

    How can I change the color of a cell when it is selected. I select the cell by pressing enter, then I want the text in the cell to change color to red, but all the cells in the table change color. Please I would be grateful for some help

    Subclass DefaultTableCellRenderer.
    public class MyCellRenderer extends DefaultTableCellRenderer
    Override
    public Componet getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
    JLabel lab = new JLabel(String)value);
    lab.setOpaque(true);
    return lab;
    if(isSelected)
    lab.setBackground(Color.red);
    else
    lab.setBackground(Color.white);
    Set the columns in your table:
    table.getCoulumModel.getColumn(0).setCellRenderer(new myCellRenderer());
    table.getCoulumModel.getColumn(1).setCellRenderer(new myCellRenderer());
    etc. for each column in your table.

  • How can I change a hex value to normal without changing the characters

    How can I change "3932" (hex displayed string) to "39 32" (normal displayed string with space)
    Solved!
    Go to Solution.
    Attachments:
    Hex to Normal without changing value.vi ‏5 KB

    I think your VI works and if I understand what your input data looks like and the output that you want is, does it?I really can't see a better way. Does it not work for what you want? What form is the actual data in as you receive it? (not how it is displayed by the display setting of the string control) You have the string control set the “Hex display” and that may be confusing some of us as to what the actual input data is.
    And what you want your output to look like. Do you get a “stream” of bytes that are the actual numbers in the form of a string?or Do you get a “string” of ASCII char that represent numbers?
    These are two different things, but may look alike depending on the display setting of your controls are set.
     Changing the display mode of a control or indicator does not change the under lying data. It only changes the way your eye “see” it, not how LabVIEW “sees” it.  We need to know what your raw input string looks like.
    tbob's snipit assume your data is one way and your VI assumes another.
    Omar
    Omar

  • How can I change my JApplet into a JApplication?

    I am working with a JApplet and am finding that some of my code only works in applications.
    So being new to this, I am clueless as to how to change my Applet into an Application. I understand the difference in definition between the two, but when it comes to looking at Applet Code and Application Code, I am not able to see a difference. (Other than an Applet stating "Applet")
    So, that being said how can I change my code so that it runs as an application and not an applet? Here is my current layout code
    import java.applet.Applet;
    import java.awt.*;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.*;
    import java.text.NumberFormat;
    import java.text.DecimalFormat;
    // Creating the main class
    public class test extends JApplet implements ActionListener
         // Defining of format information
         JLabel heading = new JLabel("McBride Financial Services Mortgage Calculator");
         Font newFontOne = new Font("TimesRoman", Font.BOLD, 20);
         Font newFontTwo = new Font("TimesRoman", Font.ITALIC, 16);
         Font newFontThree = new Font("TimesRoman", Font.BOLD, 16);
         Font newFontFour = new Font("TimesRoman", Font.BOLD, 14);
         JButton calculate = new JButton("Calculate");
         JButton exitButton = new JButton("Quit");
         JButton clearButton = new JButton("Clear");
         JLabel instructions = new JLabel("Please Enter the Principal Amount Below");
         JLabel instructions2 = new JLabel("and Select a Loan Type from the Menu");
         // Declaration of variables
         private double principalAmount;
         private JLabel principalLabel = new JLabel("Principal Amount");
         private NumberFormat principalFormat;
         private JTextField enterPrincipal = new JTextField(10);
         private double finalPayment;
         private JLabel monthlyPaymentLabel = new JLabel("  Monthly Payment    \t         Interest Paid    \t \t            Loan Balance");
         private NumberFormat finalPaymentFormat;
         private JTextField displayMonthlyPayment = new JTextField(10);
         private JTextField displayInterestPaid = new JTextField(10);
         private JTextField displayBalance = new JTextField(10);
         // Creation of the String of arrays for the ComboBox
         String [] list = {"7 Years @ 5.35%", "15 Years @ 5.50%", "30 Years @ 5.75%"};
         JComboBox selections = new JComboBox(list);
         // Creation of the textArea that will display the output
         private TextArea txtArea = new TextArea(5, 10);
         StringBuffer buff = null;
         // Initializing the interface
         public void init()
              // Creation of the panel design and fonts
              JPanel upper = new JPanel(new BorderLayout());
              JPanel middle = new JPanel(new BorderLayout());
              JPanel lower = new JPanel(new BorderLayout());
              JPanel areaOne = new JPanel(new BorderLayout());
              JPanel areaTwo = new JPanel(new BorderLayout());
              JPanel areaThree = new JPanel(new BorderLayout());
              JPanel areaFour = new JPanel(new BorderLayout());
              JPanel areaFive = new JPanel(new BorderLayout());
              JPanel areaSix = new JPanel(new BorderLayout());
              Container con = getContentPane();
              getContentPane().add(upper, BorderLayout.NORTH);
              getContentPane().add(middle, BorderLayout.CENTER);
              getContentPane().add(lower, BorderLayout.SOUTH);
              upper.add(areaOne, BorderLayout.NORTH);
              middle.add(areaTwo, BorderLayout.NORTH);
              middle.add(areaThree, BorderLayout.CENTER);
              middle.add(areaFour, BorderLayout.SOUTH);
              lower.add(areaFive, BorderLayout.NORTH);
              lower.add(areaSix, BorderLayout.SOUTH);
              heading.setFont(newFontOne);
              instructions.setFont(newFontTwo);
              instructions2.setFont(newFontTwo);
              principalLabel.setFont(newFontThree);
              monthlyPaymentLabel.setFont(newFontFour);
              displayInterestPaid.setFont(newFontFour);
              displayBalance.setFont(newFontFour);
              areaOne.add(heading, BorderLayout.NORTH);
              areaOne.add(instructions, BorderLayout.CENTER);
              areaOne.add(instructions2, BorderLayout.SOUTH);
              areaTwo.add(principalLabel, BorderLayout.WEST);
              areaTwo.add(enterPrincipal, BorderLayout.EAST);
              areaThree.add(selections, BorderLayout.NORTH);
              areaFour.add(calculate, BorderLayout.CENTER);
              areaFour.add(exitButton, BorderLayout.EAST);
              areaFour.add(clearButton, BorderLayout.WEST);
              areaFive.add(monthlyPaymentLabel, BorderLayout.CENTER);
              areaSix.add(txtArea, BorderLayout.CENTER);
              // Using the ActionListener to determine when each button is clicked
              calculate.addActionListener(this);
              exitButton.addActionListener(this);
              clearButton.addActionListener(this);
              enterPrincipal.requestFocus();
              selections.addActionListener(this);
         }

    baftos wrote:
    Here is one of the sites that explains the procedure:
    [http://leepoint.net/notes-java/deployment/applications_and_applets/70applets.html].
    But maybe you should try to fix the code that does not work as applet?
    Which one is it?
    >Here is one of the sites that explains the procedure:
    [http://leepoint.net/notes-java/deployment/applications_and_applets/70applets.html].
    But maybe you should try to fix the code that does not work as applet?
    Which one is it?
    The code that doesn't work in my applet is the exit button code
    else if (source == exitButton)
                        System.exit(1);
                   }I also can't get my program to properly validate input. When invalid input is entered and the user presses calculate, an error window should pop up. Unfortunately it isn't. I compile and run my applications/applets through TextPad. So when I try to test the error window by entering in invalid info, the applet itself shows nothing but the command prompt window pops up and lists errors from Java. Anyhow, here is the method I was told to use to fix it.
    private static boolean validate(JTextField in)
              String inText = in.getText();
              char[] charInput = inText.toCharArray();
              for(int i = 0; i < charInput.length; i++)
                   int asciiVal = (int)charInput;
              if((asciiVal >= 48 && asciiVal <= 57) || asciiVal == 46)
              else
                   JOptionPane.showMessageDialog(null, "Invalid Character, Please Use Numeric Values Only");
                   return false;
                   return true;
         }My Instructor told me to try the following, but I still can't get it to work.String content = textField.getText();
    if (content.length() != 0) {       
    try {          Integer.parseInt(content);  
    } catch (NumberFormatException nfe) {}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Can I change Encoding used in InputStreamReader

    Hi Java Gurus:
    Wanted to know if I can somehow change the encoding used by InputStreamReader, the value of which I get by InputStreamReader.getEncoding().
    I did change file.encoding to UTF8, but that does not change the encoding used by InputStreamReader.
    I am getting garbage data when reading a chinese character from a Swing GUI. If I convert the string into a byte array using utf8 encoding, the bytes look OK, but when I print the string, it is all garbage and gets stored in the database (thru JDBC) as garbage (?)
    Any pointer(s) would be a great help guys!
    Thanks,
    Micky G

    Hi Mickey,
    Wanted to know if I can somehow change the encoding used by InputStreamReader,
    the value of which I get by InputStreamReader.getEncoding().Easiest way is to specify the Charset or Charset name String in the constructor,e.g.:
    InputStreamReader isr = new InputStreamReader(iStream,  "UTF-16")
    I am getting garbage data....I don't quite follow what you're describing in this paragraph. Can you elaborate?
    Regards,
    Joe

  • Changing the Host String in Oracle 10.2.0.4

    Hi,
    Can you please let me know how to change the Host String from ORCL to "production".
    I login now using the details below,
    UN: system
    PWD: production
    Host String: orcl
    Any help would be highly appreciated.

    Pravin wrote:
    Hi,
    I tried it but doesnt seem to work. Anyhow, i created a new database with my requirements and thus issue got resolved.
    Maybe you should have provided a bit of detail to "doesn't seem to work".
    I hope you didn't build a whole new house just because you couldn't get the key fit the front door . . .
    Thanks for your response. Appreciate it.Edited by: EdStevens on Sep 27, 2010 3:43 PM

Maybe you are looking for