Sunday, November 29, 2009

Speech For An Anniversary Of A Company

JFreeChart Examples - Part 2

charts-excel-2007 This time I bring you yet another example .... the graph is PieChart that like the above examples whether to put in a project aparte necesita que agreguemos las librerías que previamente configuramos .

Todos estos gráficos se colocan en un JFrame ….si alguien sabe como colocarlo dentro de un JInternalFrame le agradecería que me apoye con esa información. Hay que tener en cuenta que los métodos que estoy usando no son todos ….hay una variedad de métodos para diseñar mejor nuestro gráfico , pero ya depende de cada uno explorar esta parte y descubrir lo que JFreeChart puede y también lo que no soporta.

Una recomendación final para poder usar mejor los métodos es necesaria la documentación , esta se genera a la hora installing the library ... but I could not make it try to make it through the apache ant but did not work (if anyone knows how to generate documentation for JFreeChart thank you for giving me this information to update the entry step installation and me help me.) Needless to say let's start with a class ... I have called PieChart:

  • This class as well as in the previous example we inherit from ApplicationFrame
     PieChart public class extends ApplicationFrame 

    After
  • that we will import the following libraries:
     import java.awt.Color; 
    import javax.swing.JPanel;
    org.jfree.chart.ChartFactory import, import
    org.jfree.chart.ChartPanel;
    org.jfree.chart.JFreeChart import, import
    org.jfree.chart.plot.PiePlot;
    org.jfree.data import. general.DefaultPieDataset;
    org.jfree.data.general.PieDataset import, import
    org.jfree.ui.ApplicationFrame;

  • After this we will build the constructor method public
     PieChart (String title) {

    super (title);
    this.setContentPane (crearDemoPanel ());}

  • Let's create crearDataSet method in which we create the graph data, this method can improve positioning a parameter which we send the data to place: private static
     PieDataset crearDataSet () {

    DefaultPieDataset DefaultPieDataset data = new ();
    data.setValue ("One", new Double (43.2));
    data.setValue ("Two", new Double (10.0));
    data.setValue ("Three", new Double (27.5));
    data.setValue ("Four", new Double (17.5));
    data.setValue ( Five ", new Double (11.0));
    data.setValue (" Six ", new Double (19.4));
    return data;}


  • Then something simple, we crearChart method ( should be noted that asks a parameter and returns an object of type JFreeChart), this method does is create the frame where the graph will (if you put instead of ChartFactory.createPieChart ChartFactory.createPieChart3D we have a 3D graphics) ;: private static JFreeChart
     crearChart (PieDataset data) 

    {JFreeChart chart = ChartFactory.createPieChart (
    "PieChart Demo", / / \u200b\u200bName
    graphic data, / / \u200b\u200bdata
    true, / / \u200b\u200bLegend
    true,
    false);
    / / Color of the window
    chart.setBackgroundPaint (Color.ORANGE) PiePlot
    plot = (PiePlot) chart.getPlot ();
    / / Color of the labels
    plot.setLabelBackgroundPaint (Color.ORANGE)
    / / Color of the background of the chart
    plot.setBackgroundPaint (Color.white);
    plot.setNoDataMessage ("No data");

    return chart;}


  • Let's create the ultimate method .. this is two lines just
     crearDemoPanel public static JPanel () {

    JFreeChart chart = crearChart (crearDataSet ());
    ChartPanel return new (chart);
    }

  • And finally in the main class: public class Main
     

    {public static void main (String [] args) {
    PieChart
    demo2 = new PieChart (PieChartDemo02 ");
    demo2. pack ();
    RefineryUtilities.centerFrameOnScreen (demo2)
    demo2.setVisible (true);
    }}


  • Finally, this is our result: image
  • The example you can download from here:
     
     
    btn_6

Saturday, November 28, 2009

Shahid Afridi Sherwani

JFreeChart Examples - Part 1

image After installing and configurations jfreechart library now proceed to see the different types of graphics we can create with this program for it will place some examples that have been found in JFreeChart demo library and on the web.

First of all let's create a new project with the NetBeans → then add the libraries that previously had set up our project for this: right-click the Libraries folder → Add Library and add the JFreeChart libraries:

image

Now we can already begin to create our graphics (this is going to do for each project you want to use the library JFreeChart).

GRAPHIC BARCHART
  • and we create a class that inherits from the Application class frame, so we must import the library: import org.jfree.ui.ApplicationFrame and this should look like: public class BartChart
     extends ApplicationFrame 


  • done this we will import the following libraries :
     import java.awt.Color; 
    import java.awt.Dimension;
    import java.awt.GradientPaint;
    import org.jfree.chart.ChartFactory;
    import org.jfree.chart.ChartPanel;
    import org.jfree.chart.JFreeChart;
    import org.jfree.chart.axis.CategoryAxis;
    import org.jfree.chart.axis.CategoryLabelPositions;
    import org.jfree.chart.axis.NumberAxis;
    import org.jfree.chart.plot.CategoryPlot;
    import org.jfree.chart.plot.CategoryPlot;
    import org.jfree.chart.plot.PlotOrientation;
    import org.jfree.chart.renderer.category.BarRenderer;
    import org.jfree.data.category.CategoryDataset;
    import org.jfree.data.category.DefaultCategoryDataset;
    import org.jfree.ui.ApplicationFrame;



  • Let's create our constructor: public

     BartChart (String title) 

    {super (title);
    crearDataset CategoryDataset dataset = ();
    JFreeChart chart = crearChart (dataset);
    ChartPanel panel = new ChartPanel (chart, false);
    panel.setPreferredSize (new Dimension (700.500));
    this.setContentPane (panel);}



  • done this
  • NetBeans will ask us to believe two methods are crearChart crearDataset and methods own that we create and we will be completing later:

     CategoryDataset private static crearDataset () {

    ........
    ........
    return dataset;}


    crearChart private static JFreeChart (CategoryDataset data) {

    ........
    ........
    return chart;}



  • Now let's fill our method crearDataset:

     CategoryDataset private static crearDataset () {

    / / Name String serial1
    rows = "First"; String
    Series2 = "Second" 3 series
    String = "Third";
    / / Name String category1
    columns = "Category1" String
    Category2 = "Category2";
    categoria3 String = "Categoria3" ;;
    categoria4 String = "Categoria4"
    categoria5 String = "Categoria5"
    DefaultCategoryDataset
    DefaultCategoryDataset dataset = new ();
    / / Here we fill our data
    / / but this data We can pass parameters dataset.addValue
    (1.0, serial1, category1);
    dataset.addValue (4.0, serial1, Category2);
    dataset.addValue (3.0, serial1, categoria3)
    dataset.addValue (5.0, serial1, categoria4)
    dataset.addValue (5.0, serial1, categoria5)

    dataset.addValue (5.0, Series2, category1);
    dataset.addValue (7.0, Series2, Category2);
    dataset.addValue (6.0, Series2, categoria3 )
    dataset.addValue (8.0, Series2, categoria4)
    dataset.addValue (4.0, Series2, categoria5)

    dataset.addValue (4.0, 3 series, category1);
    dataset.addValue (3.0, 3 series, Category2);
    dataset.addValue (2.0, 3 series, categoria3)
    dataset.addValue (3.0, 3 series, categoria4)
    dataset.addValue (6.0, 3 series, categoria5)

    dataset.addValue (1.0, serial1, category1);
    dataset.addValue (4.0, serial1, Category2);
    dataset.addValue (3.0, serial1, categoria3)
    dataset.addValue (5.0, serial1, categoria4)
    dataset. AddValue (5.0, serial1, categoria5)
    return dataset;}



  • We will fill the following method, I hope that the comments are clear (if you want to change the direction of the bars we put PlotOrientation.VERTICAL laying in the example):

     crearChart private static JFreeChart (CategoryDataset data) 
    {JFreeChart chart = ChartFactory
    . createBarChart (
    "BartChart Demo", / / \u200b\u200bName of the graph
    "Category", / / \u200b\u200bName
    Horizontal axis "values", / / \u200b\u200bName
    vertical axis data, / / \u200b\u200bData
    PlotOrientation.HORIZONTAL, / / \u200b\u200bOrientation
    true, / / \u200b\u200bInclude
    legend true, / / \u200b\u200binformation when mouse
    true) / / URls
    / / Change the color of the bottom panel chart.setBackgroundPaint
    (Color.ORANGE)
    / / Change the color of each category
    CategoryPlot plot = (CategoryPlot) chart.getPlot ();
    plot.setBackgroundPaint (Color.Blue)
    / / background color graphic plot.setBackgroundPaint
    (Color.white);
    / / dividing lines
    plot.setDomainGridlinesVisible (true);
    plot.setRangeGridlinePaint (Color.Black);
    / / Calculation of the x-axis final
    NumberAxis rangeAxis = (NumberAxis) plot.getRangeAxis ();
    rangeAxis.setStandardTickUnits (NumberAxis.createIntegerTickUnits ());

    Sweepers renderer = (sweepers) plot.getRenderer ();
    renderer.setDrawBarOutline (false);
    / / Change the color of each bar
    GradientPaint GP0 = new GradientPaint (0.0f, 0.0f, Color.blue, 0.0f, 0.0f, new Color (0,0,64));
    GradientPaint gp1 = new GradientPaint (0.0f, 0.0f, Color.green, 0.0f, 0.0f, new Color (0,64,0));
    GradientPaint gp2 = new GradientPaint (0.0f, 0.0f, Color.Red, 0.0f, 0.0f, new Color (64,0,0));
    renderer.setSeriesPaint (0, GP0)
    renderer.setSeriesPaint (1, gp1);
    renderer.setSeriesPaint (2, gp2);
    plot.getDomainAxis
    CategoryAxis domainAxis = ();
    domainAxis.setCategoryLabelPositions (
    CategoryLabelPositions.createUpRotationLabelPositions (Math.PI/6.0));
    return chart;}



  • Finally, in our main class write the following: import

     org.jfree.ui.RefineryUtilities; 
    public class Main {

    public static void main (String [] args) {
    BartChart
    demo1 = new BartChart (BarChartDemo01 ");
    demo1.pack ();
    RefineryUtilities.centerFrameOnScreen (demo1)
    demo1.setVisible (true);}

    }



  • This is the final result:

    image




  • The example can be downloaded from here:



btn_6

Thursday, November 19, 2009

I Like Looking At My Mums Boobs

dynamic charts and graphs in Excel 2007

chart

A PivotTable is an interactive table that contains fields, which are used to summarize and analyze based on several criteria for grouping, represented as a crosstab which facilitates the interpretation of such data. It is dynamic because it allows us to obtain different total, filtering data, changing the presentation of data, displaying or not the data source, etc. The pivot table can be updated as data are updated in the source table. From this table we can create a dynamic graphic which like the dynamic tabal relates PivotTable data itself, ie if data is changed on either side of the graph also changes. Without further ado let's see how to create a PivotTable:

  • To start with, we have a simple table like this (obviously you can get more data): image
  • Next step is to select the table CTTRL + E (or simply leave the cursor within the table) and go to Insert and choose PivotTable (note that we can also choose to create a dynamic chart, but are we going to do next) : image
  • Done this we will get a window where we see that all the source table has been selected, this window can be given the option to place the PivotTable in the current worksheet or else we can put in a new one: image
  • done this, you will create a new spreadsheet as shown: image
  • Now we just have to add a check to the headers you want displayed in the PivotTable, and see how it will creating the table: image
  • can use the options tab of the PivotTable to perform multiple options such as creating a PivotChart, for this we click the PivotTable and automatically get the option at the top: image
  • PivotChart We click and automatically create our PivotChart (choose the type of chart you want to use): image
  • And we will have our dynamic graph, which can be updated by moving the data source and then update: image
  • can use chart tab and the tab presentation to give a better presentation to our chart: image image
  • can guide us better with this video:

FOR EXCEL 2007

FOR EXCEL 2003

Monday, November 16, 2009

Kits For Building A Toy Chest

A new life ... Freebies



Holaaaaaaaaaaaaaa !!!!:

Marta was born on 20th of October, has been a great pregnancy, removing the heat of the summer months, I did not think it was so annoying!, otherwise everything was great.

The small is a glutton, and is healthy and beautiful:)

feel the slowdown in blog, but I find it difficult to devote the time required! I have a head full of ideas! I was going to explode! :) But now with two young children, I am very committed to them. During pregnancy I did not want to sit at the computer, and now little by little I guess I'll go looking for some little hole!

Many thanks to those who contact me to know what so I left, thanks really.

Thanks to the fans who continue to rise, many thanks.

hope to be able to post more often,

voladoooores Besitos!

Watch South Park Without Flash Drive

Relocate favorites folder IE and Firefox

favorite_user When you install Firefox, IE or Google Chrome on our PCs, they automatically create default profiles for your browser.
This folder contains all the information related to the browser: For firefox (bookmarks, browsing history, extensions installed, etc..), IE (favorite), etc. The drawback of this folder is located on the partition where the operating system. If for any problems we could not access the operating system, would lose all this information.
To avoid this data loss (which in many cases are valuable) modify the storage place for all these markers, so we must take into account the browser you use:

I. - FOR FIREFOX
  1. MOVING favorites folder:
    • First of all we must show hidden files, this depends on the system operation in which we find:
    1. In Xp is simple: Open any folder → Tools → Folder Options → We go to the View tab and select the option of viewing , folders and drives hidden.
    2. Windows Vista and Windows 7 : not bring the default toolbar so we will open any folder to organize → Design and we check the menu bar and make the above.
    3. For Linux: is something similar, open the folder Home → we go to View → and activate the option to view hidden folders.
    • Now let's move the contents of the default folder to a new location we have created:
    1. For XP: C: \\ Documents and Settings \\ NOMBRE_DE_USUARIO \\ ApplicationData \\ Mozilla \\ Firefox \\ Profiles
    2. For Windows Vista y 7 : C: \\ users \\ NOMBRE_DE_USUARIO \\ ApplicationData \\ Local \\ Mozilla \\ Firefox \\ Profiles
    3. For Linux: / home / NOMBRE_DE_USUARIO / mozilla / firefox /
    • In this folder you will find a folder named: xxxx.default; is this folder that we will move as this represents the default Firefox profile created at the time of installation (copy this folder to a new address.) image
  2. CREATING A NEW PROFILE:
    • We make sure to close all Firefox windows (for it opened the task manager), go to the Processes tab and look for those firefox.exe processes say we select and click End Process .
    • Now we must open the profile editor, for which there are several options depending on the operating system on which we meet:
    1. For XP: Menu → Start → Run → firefox.exe - profilemanager (two "-" before profilemanager)
    2. For Windows Vista and Windows 7: In the search bar menu write start firefox.exe - profilemanager
    3. For any distro of Linux: → Open the terminal firefox - profilemanager
    • We will get this window: image
    • is where we create a profile, for they do click Create Profile and we will get a window in which we give next.
    • Then post the name of our profile, we choose the location of our folder (The one we chose in the previous step) and we click finish: image
    • done this and have our profile created: image
    • Now we can only select the profile "default" and delete it.
II .- FOR IEXPLORER
  1. For Internet Explorer is even easier, we first create a folder called favorites in the unit you want.
  2. Now we are in the default folder → Right click → Location → Move and select the folder we created above: image
  3. And that's all ready .. now we have our favorites on a different drive.
numcommentsR

is not advisable to use external drives (eg USB) drives you to save bookmarks, themes, etc. , To be chosen as a hard disk drive internal.

Sunday, November 15, 2009

How Many Snow Chains Do U Need For A Car

Java How to Program - Deitel & Deitel Installing JFreeChart

Well here's

I leave the links so you can download the book Java How to Program Deitel & Deitel, and these are divided into 3 parts which can be downloaded from my SkyDrive by clicking the following icon:

The book contains the following chapters:

  • CAP 00: Preface
  • CAP 01: INTRODUCTION TO COMPUTERS
  • CAP 02: INTRODUCTION TO THE JAVA APPLICATION
  • CAP
  • 03: INTRODUCTION TO THE APPLETS
  • CAP 04: CONTROL INSTRUCTIONS - PART 01
  • CAP 05: CONTROL INSTRUCTIONS - PART 02
  • CAP 06: METHODS
  • CAP 07: ARRANGEMENTS
  • CAP 08: object-oriented programming
  • CAP 09: OOP
  • CAP 10, CAP
  • POLYMORPHISM 11: Strings and Characters
  • CAP 12: JAVA 2D GRAPHICS AND CAP
  • 13: GUI - PART 01
  • CAP 14: GUI - PART 02
  • CAP 15: HANDLING OF EXCEPTIONS
  • CAP 16: Multithreading
  • CAP 17: Files and Streams
  • CAP 18: NETWORKS
  • CAP 19: IMAGES AND SOUNDS IN THE APPLETS
  • CAP
  • 20: DATA STRUCTURE
  • CAP 21, CAP 22
  • PACKAGES: COLEECCIONES
  • CAP 23: CONNECTIVITY DATABASE
  • CAP 24, CAP 25
  • Servlets, JSP
  • CAP 26: FINAL PART

UPDATE: Thanks to a message that I got my mail Cabrera Genesis, as I said there on the Internet 7th Edition and is available at: taringa where can download. The interesting thing is that pages are not scanned in full color, ie the image quality is very good ... lol the only bad = '(is that it is in English.

image

Friday, November 13, 2009

Do Have To Have A Prescription To Buy Catheters



partition Project JFreeChart which was released in 2000 is an open source library (Open Source) for Java, which allows you to create diagrams in a practical and simple. With JFreeChart can make different kinds of graphics ranging from the common types such as pie charts , bar charts, area charts, line charts, histograms, Gantt charts, more specific and less types often used as Candlestick, Wind and Wafer Map. For more information on this review Javadoc documentation and ChartFactory JFreeChart classes.

I. - Conditions

You must download download the JFreeChart package, optionally also recommend downloading the package JCommon. Even a partial version of it is already included in JFreeChart.

II-SETTING AND THE JFreeChart JCOMMON

then begin the steps to configure JFreeChart in NetBeans IDE:

  1. Once downloaded the package and the package JFreeChart JCommon unzip it into a directory on the PC. image
  2. Now open the NetBeans to configure JCommon libraries JFreeChart and therefore in NetBeans we go to the Tools menu and select Libraries: image
  3. We click on New Library and type "JCommon-1.0.16" as the name of the library then go to the tab Classpath → Add Jar / Folder and then seek the direction of JCommon downloaded above and select the file JCommon-1.0.16.jar: image image
  4. Do the same with the jar JFreeChart unload the eye in the jar we selected in this case is the lib folder. image
  5. done this and have set up libraries in JFreeChart and NetBeans JCommon; hour and we can generate a graph.
numcommentsAM NOTE: Keep in mind that we have only added the JAR but we have not generated the documentation of the files we have placed in the libraries, one way is by offering apache ant file but not yet placed because I'm reviewing it, when I run will update the blog or if anyone knows how to do it (build the javadoc) to support me I would appreciate the info.

III .- CREATING A GRAPHIC ON USING JFreeChart NETBEANS

  • create a new project, for this go to File menu → New Projct → Java Application and leave the Create Main Class enabled us to generate the main class (this is not essential for the generation can be placed on a graphics class by itself - just for sake of the example we are going to do so -)
  • Now let's add the libraries you have previously added to this new project, for this go to the Projects tab → Libraries → On node Right click and select add Library and jCommon JFreeChart libraries. image
  • And now in the Main class will post the following:
     jfreechart package, import 

    org.jfree.chart.ChartFactory;
    org.jfree.chart.ChartFrame import, import
    org.jfree.chart.JFreeChart ;
    org.jfree.data.general.DefaultPieDataset import;


    public class Main {public static void
    main (String [] args) {

    / / Create a dataset
    DefaultPieDataset DefaultPieDataset data = new ();
    data . setValue ("Categría 1", 43.2);
    data.setValue (Categría 2 ", 27.9);
    data.setValue (" Categría 3 ", 79.5);
    / / Create a Chart
    JFreeChart chart = ChartFactory.createPieChart (
    " JFreeChart Example ", / / \u200b\u200bTítrulo
    chart data,
    true, / / \u200b\u200bLegend
    true, / / \u200b\u200btrue
    ToolTips )
    / / create a kind of frame and display the JFreeChart it
    / / This constructor calls us the title of the chart and the chart created
    ChartFrame frame = new ChartFrame (First for javax0711 Chart ", chart);
    frame.pack ();
    frame.setVisible (true);
    }}



  • compile, run the application and ready and we have our first graph generated image

Monday, November 9, 2009

Energy Drink Distribution



Sin título Well now let's take one of the many courses published in aulaclic.com which is recommended because, and here you will find excellent material.

When working with a personalized book that is, we have defined a number of specific characteristics may be the type font, the color of certain cells, formats and similar calculations, we lose a lot of time to format the entire book if you have many leaves.

macros With the aim is to automate several tasks and merge into one, adding such a button in our book that when you click on it to perform all these tasks.

The easy and intuitive way of creating macros is to create them using the macro recorder that is available to Excel.

This macro recorder lets you record the desired actions that subsequently translated into instructions in VBA, which can be changed later if have programming skills.

To record a macro must access the View tab and displays the Macros submenu in the submenu and select the Record Macro ...

addition to this option in the menu you can find the following options:

View Macros ... - Where access a list of macros created in that book.

Use relative references - With this option using Reactive references to macros are captured in action on the selected initial cell.

When you select Record Macro ..., the first thing you see is the Record Macro dialog box where you can give a name to the macro (not allowed to insert blank spaces in the name of the macro).

We assign a shortcut: Using the combination of CTRL + "key on the keyboard." The problem is to find a combination that does not already use Excel.

macro Under Save in: We can choose to store the macro in the active workbook in the personal macro workbook or another workbook.

In Description: we can describe what is the role the macro or any other information that we see fit.

To begin recording the macro press the OK button, and then if you look at the status bar, find the button in the status bar where we have the option to stop recording.

Since then we perform the actions you want to record, it is advisable not to select any cell from the recording, because if you select any cell then when you run the macro, the selection problems we can cause cells outside range.

Upon completion of the actions we want to record, pressed the Stop button in the status bar, or by accessing the Macros menu and clicking.

Welcome And Greetings Religious

Enable Macros in Excel Ubuntu menu by pressing the Windows

ubuntu-keys-laptop-924 Maybe most people like me that we are just starting out in the free software (that's our first]:) hehehe), we find it hard to adapt, and that if we wanted to go to the Windows start menu because it was only a matter of pressing a key and we were on the menu in Ubuntu does not set default, then it should be set as follows:
  • Let
    System → Preferences → Keyboard Shortcuts ().

  • Once there look for the action: Show the panel menu ; we do click and then press the Windows key, and it automatically asignará.Nos be something like:

Sunday, November 8, 2009

Free Sheet Music To Mountains By Biffy Clyro

String Class

java_programmers_brain_screensaver_preview The String class represents a string of characters. All the string literals such as "abc" are implemented as instances of this class.
The class String includes methods for examining individual characters of a string to compare, locate and remove them as sub chains to create copies of a string converting all characters to uppercase or lowercase.
Java provides special support for the concatenation (joining) chain operator (+). and to convert other objects cadenas.La String concatenation is implemented through the StringBuffer class and its append () method. The conversions are implemented through the method toString () defined in the Object class which is inherited by all classes in Java.

I. - TO CONSIDER:
  1. The String class belongs to the package java.lang.
  2. There are different ways to create String objects as:
    • String str = "abc";
    • char str [] = {'a', 'b', 'c'}; / / array of characters
    • String str = new String ("abc"); / / Object with initial value "abc"

  3. The language Java provides operator "+" to concatenate (join) String objects.

  4. A String represents a string-coded, therefore, an operation as converting to uppercase or lowercase does not modify the original object but returns a new object with the string resulting from this operation which should be stored in another string.
II .- CLASS HIERARCHY
image
III .- most important methods
  1. String (String value) .- The Used when you want to create a string:
    • String str = "Hello"
    • String str = new String ("Hello") / / Constructor for the String class


  2. cadena.concat (string txt) .- It returns a new String object concatenation of two strings:

  3.  String str = "Hello" 
    cadena.concat result = String ("World ");// The Hello world result will

  4. cadena.compareTo (String another string) .- lexicographically Compare the string with another string, this character by character comparison is given that the capital letters are larger than tiny - this is according to the ASCII or UNICODE - as it returns:


    • \u0026lt;0: if string \u0026lt;another string
    • = 0: if another string str =
    • > 0: if string> another string
    • Example: JUAN
    • > juan
    • Juan> Carlos
    • JUAN> JOHN
    • abcde> abcdefg

  5. cadena.toIgnoreCase (String another string) .- compareTo does the same thing but with only difference does not distinguish between uppercase and lowercase letters, ie: John = john
  6. cadena.length () .- Returns the length or number of characters in the string:

    String str = "Hello World";
    cad.length ();// int qty = value cannot be 10
  7. cadena.toLowerCase () .- Converts uppercase to lowercase
  8. chain
  9. cadena.toUpperCase () .- Converts uppercase to lowercase chain.


     String str1 = "This is a test"; 
    cad1.toUpperCase ();// String str2 = str2 will be: THIS IS A TEST.

  10. cadena.trim () .- Removes blank spaces to be at the beginning or end of the chain.


     String str1 = "This is a test"; 
    cad1.toLowerCase ();// String str2 = str2 = This is a test.

IV .- METHODS

Char boolean int
BUILDERS
Constructor
Description
String ()
Creates a new empty String no characters.
String (byte [] bytes)
Create a new String object initialized with the characters equivalent to each number stored in the array of bytes.
String (char [] value)
Create a new String object initialized with the characters in the array given as parameter.
String (String string)
Create a new String object initialized with the given value as a parameter.
METHODS
Return Type
Method
Description

charAt (int index)
Returns the character at index given as parameter.
int
compareTo (String otraCadena)
Returns as integer the result of the comparison between the chain calls him otraCadena. If the return parameter is "0" means that the two strings are equal, making the comparison character with differing uppercase character to lowercase.
int
compareToIgnoreCase (String otraCadena)
Returns as integer the result of comparing the string with otraCadena calls. If this integer is 0 means that the strings match, being the character comparison with character but ignoring the differences between upper and lower case.
String
concat (String otraCadena)
Returns the result of the concatenation of the string given as parameter otraCadena.

equals (Object anotherObject)
Returns true if the string that is equal to the object name submitted as a parameter.
boolean
equalsignoreCase (String otraCadena)
Returns true if the string is equal to call him Dad as a parameter string ignoring differences between upper and lower case.
int
indexOf (String str)
Return the position of first occurrence of the given string found as a parameter in the string that calls the method.
int
indexOf (String str, int ini)
Returns the position of the first found occurrence of the string given as parameter but starting the search from the initial position given as parameter.
int
lastIndexOf (String str)
Return the position of last occurrence of the string given as parameter.

lastIndexOf (String str, int ini)
Returns the position of last occurrence of the string given as parameter searching backward from the position given as a parameter.
int
length ()
Returns the number of characters in the string.
String
replace (char car1, char car2)
Returns a new string resulting from replacing all occurrences of the character "car1" by the character "car2" given as parameters.
String
replaceAll (String str1, String str2)
Returns a new string resulting from replacing all occurrences of the string sub for sub str1 str2 string given as parameter .
boolean
startsWith (String str)
Returns true if the string that calls the method starts with the substring cad given as parameter.

String substring (int posIni)
Returns a substring whose first character starts at position posIni given as parameter.
String
substring (int posIni, int posFin)
Returns a substring whose first character posIni position begins and ends with the character of posFin position.
String
toLowerCase ()
Returns a new string by converting all characters a minúsculas.
String
toUpperCase ( )
Retorna una nueva cadena como resultado de convertir todos los caracteres a mayúsculas.
String
trim ( )
Retorna una nueva cadena como resultado de omitir los espacios en blanco al inicio y al final de la cadena.

V.- EJEMPLOS

  1. Design an application that can manipulate the characters in a substring by the methods seen.

    image

    • create a new project which will place it in a package, in this new package we image add a JFrame to which we will distribution type GridLayout with 2 columns, done this in the first column put a JPanel (JPANEL1) and give a distribution of BorderLayout (in this panel placed in the north a text box in the CENTER a ScrollPane and over a txtArea ... finally in the south place a label), the second column put another JPanel (JPanel2) with GridLayout distribution on 2 columns and 7 rows and simply drag buttons to the panel and see which will be ordered as shown in the picture above. Are reminded to visit this entry to get more information about the types of distribution and this entry to see how to create a NetBeans project. Well done all of this object in view will look like this (Note the way how it is distributed)



    • Now let's program each button, for this alone is enough to give NetBeans and then double-click will take you to the corresponding method:



      • We will schedule button length which will tell us how many characters of the string that will get into the textArea; to be able to get the value entered in the text box and will use the getText method to write the output in the text area will use the setText method.

        private void
         btnLongitudActionPerformed (java.awt.event.ActionEvent evt) {
        / / read the message
        txtMensaje.getText str = String ();

        / / get the length longitudinal = cadena.length
        int ();

        / / prints txtSalida.setText
        length ("The text entered is: "+ longitudinal +" characters. ");
        }


      • returned to the designer and you double click the button to separate words and enter the following code:


         private void btnSeparaPalabrasActionPerformed (java.awt.event.ActionEvent evt) {
        / / read the message String
        str = txtMensaje.getText ();
        / / get
        int length = cadena.length longitudinal ();
        / / clean area
        txtSalida.setText
        (""); / / initialize counter int
        words contpala = 0 ;
        / / separating words by space

        do {/ / do not consider space at the beginning or end
        cadena.trim str = ();
        / / locates the first character position int pos = white
        cadena.indexOf ('');
        / / get word found
        String word = "";
        if (pos> 0)
        cadena.substring word = (0, pos +1);

        else word = string;
        / / prints txtSalida.append
        found word (word + "\\ n");
        / / ignore string = word found
        cadena.substring (palabra.length ());
        / / update contpala
        word count + +;
        } while (cadena.length ()> 0);
        / / print counter txtSalida.append
        words ("\\ n" + contpala + "words found.");}



      • Do the same with the case
        button private void
         btnMayusculasActionPerformed ( java.awt.event.ActionEvent evt) {
        / / TODO add your handling code here:
        / / read the message
        String str = txtMensaje.getText ();
        / / converts it to uppercase
        cadena.toUpperCase str = ();
        / / prints new string in uppercase
        txtSalida.setText (Text converted to upper case: \\ n "+ str) ;}

      • And with the tiny button:
        private void
         btnMinusculasActionPerformed (java.awt.event.ActionEvent evt) {
        / / read the message
        txtMensaje.getText String str = ();
        / / converts it to lowercase
        cadena.toLowerCase str = ();
        / / prints new
        txtSalida.setText string lowercase ("Text converted to lower case: \\ n" + string);
        }


      • The same character with the button and other buttons (which for reasons of time and space are not going to drop but you can download it by clicking the download button)


      image
    • finally run with F6
btn_6