Ramen

Inhoud blog
  • emnTekstverbeteringTester :: Voorbereiding :: Deel 3
  • Opmaken van een spellinglijst : emnTekstverbeteringTester :: Voorbereiding
  • emnTekstverbeteringTester Deel 2
  • TekstverbeteringsTester emn :: deel 1 Voorbereiding
  • Open and close Stage and scene. Scenes stored in Hashmap
  • JavaFX FXML voorbeelden | JavaFX FXML examples
  • Eigenschappen voorbeeld uit vorig blog | Properties sample from previous blog
  • Meervoudige fxml bestanden laden | Loading multiple fxml files and controllers
  • Move from one object to another :: JavaFX
  • JavaFX templates
  • JavaFX FXML webbrowser
  • JavaFX ProgressIndicator - ProgessBar
  • Draai scene builder vanuit eclipse - Run scene builder from within eclipse.
  • FXML voorbeeld voor eclipse | FXML sample for eclipse
  • Wapenschild Hamerlinck
  • Wapenschild Hamerlinck
  • Zelf oefeningen maken :: educatie , talen , enquetes
  • ST. PATRICKS DAY PARADE
  • Hulp programma voor het leren van vreemde talen.
  • Javascript :: tekst sorteren op unieke woorden :: sort text
  • Code sorteer tekst : sort text :: javascript
  • onze tuin
  • Aston Ariel op bezoek
  • Hulpprogramma's :: Lezen | RSS - Nieuws
  • Presentationmodel :: buffered model :: RiverLayout
  • Make a separator for RiverLayout:
  • Customize combobox (binding JGoodies):: Riverlayout
  • Test Riverlayout :: sample
  • Project pw Helpdesk
  • LookAndFeel
  • JGoodies binding - RiverLayout
  • JGoodies binding and RiverLayout
  • Enkele JAVA gebonden afkortingen
  • Java Persistence with Hibernate
  • Exel : Woorden vervangen in tekst m.b..v een macro
  • Systray : verwijderen tags taakbalk. Wijzigingen start programma's
  • Scholier kraakt pornofilter van 50 miljoen euro
  • Items Kantorenproject
  • Minimumindeling van het algemeen rekeningstelsel
  • Items Java - eclipse
    Beoordeel dit blog
      Zeer goed
      Goed
      Voldoende
      Nog wat bijwerken
      Nog veel werk aan
     
    Foto
    Foto
    Foto

    rss nieuws

    Europa voor de meeste voorstanders meer en meer een grote teleurstelling
    Zoeken in blog


    Een kijk op....
    15-11-2008
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Javascript :: tekst sorteren op unieke woorden :: sort text
    Code om een tekst uiteen te rafelen in afzonderlijke woorden de dubbels eruit te halen en de woorden te sorteren.

    In de huidige code worden enkel de volgende tekens weggeflterd. Indien je ook andere tekens wil elimineren moet fe deze code aanpassen :
    var chars =  new Array(''','<','>','-','(',')','{','}','"','.','?','¿','¡','!',':',';',',');


    De volledige code kan je copieëren in de hier onderstaande tabel.Wil je een werkend voorbeeld thuis op je pc copieer dan de code,plak deze  in je kladblok en je bewaart het bestand als een HTML - bestand.

    Test de code :: druk hier


    Javascript that separates all the words in a text , deletes the duplicates and sorts the remaining words.

    In the current code, only the following characters are filtered. If you want to filter other characters out of the result, you must adapt the following code :
    var chars = new Array (''','<','>','-','(',')','{','}','"','.','?', '¿','¡','!',':',';',',');

    You can copy the full code in the table below..

    Test the code here: Click here


    Javascript que separa todas las palabras en un texto, elimina los duplicados y ordenar todas las palabras.

    En el código actual, sólo los siguientes caracteres son filtrados. Si no desea otros caracteres en el resultado
    , usted debe adaptar el siguiente código:
    var caracteres = new Array (''','<','>','-','(',')','{','}','"','.','?', '¿','¡','!',':',';',',');

    Puede copiar el código completo en el cuadro que figura a continuación ..


    Probar el código aquí:   Click aqui

     

     

    15-11-2008 om 18:59 geschreven door de makers


    » Reageer (0)
    13-11-2008
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Code sorteer tekst : sort text :: javascript

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">

    <HTML>
    <HEAD>
       
        <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
        <TITLE></TITLE>
        <META NAME="GENERATOR" CONTENT="OpenOffice.org 3.0  (Win32)">
        <META NAME="AUTHOR" CONTENT="piet willems">
        <META NAME="CREATED" CONTENT="20081112;20170300">
        <META NAME="CHANGED" CONTENT="0;0">
    <style>

    .schrijfstijl{border: 1px solid #4D636F; font-family:Tahoma; font-size:10pt}
    .mini{font-family:Tahoma; font-size:7pt;text-spacing:-1px;line-height:90%}
    </style>


        <script language=javascript>


        function splitsource(){
       
            var temp,temptemp;
            var defstring;
            var tempsplit = new Array(); // final array
            var split = new Array();
           
           
            temp = document.sourceform.source.value;
            temp = temp.toLowerCase();
            temp=temp.split("n");


            for(var i=0;i<temp.length;i++){
                temp[i] = removechars(temp[i]);
                 temptemp = temp[i].split(" ");
                 // second split on every space in the frase.
                tempsplit = tempsplit.concat(temptemp);
                // add the second split to the final array.
            }
           
            tempsplit.sort();
            tempsplit = RemoveDuplicates(tempsplit);
            //make tempsplit array displayable:

            for(i=0;i<tempsplit.length;i++){
                split = split+tempsplit[i]+"<br>";   
            }
            document.getElementById('result').className = 'schrijfstijl';
            document.getElementById('result').innerHTML = split; //
        }
       
        function removechars(string){
            var chars = new Array(',','r','n',''','<','>','-','(',')','{','}','"','.','?','¿','¡','!',':',';',',');
            // add (or change) here char's to the array if other char's need to be
            // removed.
            for(var c=0;c<chars.length;c++){
                string = string.replace(chars[c]," ");
            }
            return string;
        }
       
        function RemoveDuplicates(arr){

            var result=new Array(); // remove the doubles
            var lastValue="";

            for (var i=0; i<arr.length; i++)
                {
                  var curValue=arr[i];
                  if (curValue != lastValue)
                      {
                    result[result.length] = curValue;
                      }
                  lastValue=curValue;
                }
            return result;
            // return this result to the array : tempsplit.
           }
       
        </script>
       
    </HEAD>

    <BODY TEXT="#000000">
    <TABLE >
            <TR>
                <TD WIDTH=522 HEIGHT=18 ALIGN=LEFT bgcolor="#990000"><u><b>
                <font face="Arial" size="2" color="#FFFFFF">Javascript </font></b></u></TD>
            </TR>
            <TR>
                <TD WIDTH=522 HEIGHT=334 ALIGN=LEFT>
                <dl>
                    <dt><font face="Arial" size="2">Deze code leest het ingaveveld =
                brontekst , sorteert de brontekst en verwijderd de
                dubplicaatwoorden.</font></dt>
                    <dt><font face="Arial" size="2">vb: </font></dt>
                    <dt><font face="Arial" size="2">Copier de volgende tekst en plak hem
                onderin het iingaveveld.</font></dt>
                    <dt><font face="Arial" size="2">Druk nadien de "Verwerk" -knop.</font></dt>
                </dl>
                <table border="0" cellpadding="5" cellspacing="0" width="400">
                    <tr>
                        <td align="left" valign="top" bgcolor="#CED8C5" style="border: 1px solid #4F6949">
                        <textarea rows="8" name="S1" cols="61" id="source" style="border: 1px solid #687D55">Je kan niet voorstellen
    hoe de mensen de laatste tijd worden belogen
    hoe ze worden bedrogen
    hoe ze worden veracht en vernederd,
    alleen nog in wat ze opbrengen
    is er nog belangstelling.</textarea> </td>
                    </tr>
                </table>
                </TD>
            </TR>
            <TR>
                <TD HEIGHT=18 ALIGN=LEFT bgcolor="#990000"><b>
                <font face="Arial" size="2" color="#FFFFFF">Ingaveveld</font></b></TD>
            </TR>
            <TR>
                <TD HEIGHT=154 ALIGN=LEFT>
                <form method="POST" name="sourceform" action="">
                    <p><textarea rows="4" name="S1" cols="62" id="source"></textarea></p>
                    <input type="button" value="Verwerk" name="B1" onclick="splitsource()">
                    <input type="reset" value="reset" name="B2">
                </form>
                <p> </TD>
            </TR>
            <TR>
                <TD HEIGHT=18 ALIGN=LEFT bgcolor="#990000"><b>
                <font face="Arial" size="2" color="#FFFFFF">Resultaat</font></b></TD>
            </TR>
            <TR>
                <TD HEIGHT=40 ALIGN=LEFT id="result"> </TD>
            </TR>
            <TR>
                <TD HEIGHT=21 ALIGN=LEFT> </TD>
            </TR>
    </TABLE>

    </BODY>

    </HTML>

    13-11-2008 om 00:00 geschreven door de makers


    » Reageer (0)
    28-08-2008
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.onze tuin
    Onze Tuin


























    28-08-2008 om 00:13 geschreven door de makers


    » Reageer (0)
    29-07-2008
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Aston Ariel op bezoek
    Aston Ariel op bezoek










    29-07-2008 om 00:00 geschreven door de makers


    » Reageer (0)
    20-07-2008
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Hulpprogramma's :: Lezen | RSS - Nieuws

    Hulpprogramma's

    Geconcentreerd lezen : Leesrol : KLIK HIER
    RSS snelnieuws : KLIK HIER

    20-07-2008 om 00:00 geschreven door de makers


    » Reageer (0)
    06-06-2008
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Presentationmodel :: buffered model :: RiverLayout
    Klik op de afbeelding om de link te volgen







    CustomerBean.java
    Structure

    package samples.s01
       
    CustomerBean.java
       
    PresentationModelBuild.java
       
    CustomerPresentationModel.java
       
    CustomBeanlaunch.java



    ----------------------------------------------------------------
    CustomerBean.java
    -----------------------------------------------------------------

    package samples.s01;

    *
     * Copyright (c) 2008 willems piet pwProTech  All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     *   - Redistributions of source code must retain the above copyright
     *     notice, this list of conditions and the following disclaimer.
     *
     *   - Redistributions in binary form must reproduce the above copyright
     *     notice, this list of conditions and the following disclaimer in the
     *     documentation and/or other materials provided with the distribution.
     *
     */

    import com.jgoodies.binding.beans.Model;

    public class CustomerBean extends Model {
        public static final String NAME_PROPERTY = "name";
        public static final String OCCUPATION_PROPERTY = "occupation";
        private String name;
        private String occupation;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            String oldValue = name;
            this.name = name;
            firePropertyChange(NAME_PROPERTY, oldValue, name);
        }

        public String getOccupation() {
            return occupation;
        }

        public void setOccupation(String occupation) {
            String oldValue = occupation;
            this.occupation = occupation;
            firePropertyChange(OCCUPATION_PROPERTY, oldValue, occupation);
        }

    }


    PresentationModelBuild.java


    package samples.s01;

    *
     * Copyright (c) 2008 willems piet pwProTech  All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     *   - Redistributions of source code must retain the above copyright
     *     notice, this list of conditions and the following disclaimer.
     *
     *   - Redistributions in binary form must reproduce the above copyright
     *     notice, this list of conditions and the following disclaimer in the
     *     documentation and/or other materials provided with the distribution.
     *
     */

    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.TextField;

    import javax.swing.JButton;
    import javax.swing.JCheckBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JTextField;

    import se.datadosen.component.RiverLayout;

    import com.jgoodies.binding.adapter.BasicComponentFactory;

    public class PresentationModelBuild extends JPanel {

        static JTextField nameInput,occupationInput;
        static JButton commitButton;
        static JButton resetButton;
        JButton sendButton;
        static CustomerPresentationModel presentationModel;

        public void createComponents() {

            presentationModel = new CustomerPresentationModel(
                    new CustomerBean());

            nameInput = BasicComponentFactory.createTextField(presentationModel
                    .getBufferedModel(CustomerBean.NAME_PROPERTY));
            occupationInput = BasicComponentFactory
                    .createTextField(presentationModel
                            .getBufferedModel(CustomerBean.OCCUPATION_PROPERTY));

            commitButton = new JButton(presentationModel.getCommitAction());
            resetButton = new JButton(presentationModel.getResetAction());
            sendButton = new JButton(presentationModel.getSendAction());
        }

        public void constructGui() {
            JFrame frame = new JFrame();
            JPanel CustomBeanFrm = new JPanel();
            frame.getContentPane().setLayout(new RiverLayout());
            frame.getContentPane().add(CustomBeanFrm);

            CustomBeanFrmGui(CustomBeanFrm);
            commitButton.setEnabled(false);
            commitButton.setEnabled(false);
            frame.pack();
            frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
            frame.setVisible(true);
        }

        private void CustomBeanFrmGui(JPanel CustomBeanFrm) {
            createComponents();
            CustomBeanFrm.setLayout(new RiverLayout());
            CustomBeanFrm.add("br left", new JLabel("PresentationModel"));
            CustomBeanFrm.add("br hfill", separator(Color.RED));


            CustomBeanFrm.add("br", new JLabel("Name"));
            CustomBeanFrm.add("tab hfill", nameInput);

            CustomBeanFrm.add("br", new JLabel("Occupation"));
            CustomBeanFrm.add("tab hfill", occupationInput);
            CustomBeanFrm.add("br hfill", separator(Color.GRAY));

           
            CustomBeanFrm.add("p br left", resetButton); // The button ins't really located to the left side
            CustomBeanFrm.add("center", sendButton);
            CustomBeanFrm.add("right", commitButton);
            CustomBeanFrm.add("br hfill", separator(Color.GRAY));

        }

        public static void clearForm() {
            commitButton.setEnabled(false);
            nameInput.setText("");
            occupationInput.setText("");

        }

        private static TextField separator(Color c) {
            TextField separator = new TextField();
            separator.setBackground(c);
            separator.setPreferredSize(new Dimension(20, 2));
            return separator;
        }
    }


    CustomerPresentationModel.java


    package samples.s01;

    *
     * Copyright (c) 2008 willems piet pwProTech  All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     *   - Redistributions of source code must retain the above copyright
     *     notice, this list of conditions and the following disclaimer.
     *
     *   - Redistributions in binary form must reproduce the above copyright
     *     notice, this list of conditions and the following disclaimer in the
     *     documentation and/or other materials provided with the distribution.
     *
     */

    import java.awt.event.ActionEvent;
    import javax.swing.AbstractAction;
    import javax.swing.Action;
    import com.jgoodies.binding.PresentationModel;

    public class CustomerPresentationModel extends PresentationModel {

        private static final long serialVersionUID = 1L;
        CommitAction commitAction;
        ResetAction resetAction;
        SendAction sendAction;
        ClearAction clearAction;
        private final CustomerBean customerBean;

        @SuppressWarnings("unchecked")
        public CustomerPresentationModel(CustomerBean customerBean) {
            super(customerBean);
            this.customerBean = customerBean;
            commitAction = new CommitAction();
            resetAction = new ResetAction();
            sendAction = new SendAction();
            clearAction = new ClearAction();

        }

        public Action getCommitAction() {
            return commitAction;
        }

        public Action getSendAction() {
            return sendAction;
        }

        public Action getResetAction() {
            return resetAction;
        }

        public Action getClearAction() {
            return clearAction;
        }
       
        private class CommitAction extends AbstractAction {
            /**
             *
             */
            private static final long serialVersionUID = 1L;

            public CommitAction() {
                super("Commit");
            }

            public void actionPerformed(ActionEvent e) {

                triggerCommit();
                //getBean();
                displayBufferAndBean("COMMIT action:");
                PresentationModelBuild.clearForm();// disable commitbutton

            }
        }

        private class SendAction extends AbstractAction {

            public SendAction() {
                super("Send");
            }

            public void actionPerformed(final ActionEvent e) {

                // getBean();
                if (PresentationModelBuild.resetButton.isEnabled()) {
                    PresentationModelBuild.resetButton.setEnabled(true);
                }

                if (isBuffering()) {
                    PresentationModelBuild.commitButton.setEnabled(true);

                    displayBufferAndBean("SEND Bufferd :true :: Not yet committed");
                } else {
                    PresentationModelBuild.commitButton.setEnabled(false);
                    displayBufferAndBean("SEND Bufferd :true :: yet Committed");
                    //Bufferd still true so by a reset the bufferd values are still available
                }

            }

        }

        private class ResetAction extends AbstractAction {

            public ResetAction() {
                super("Reset");
            }

            public void actionPerformed(ActionEvent e) {

                // release():
                // Removes the PropertyChangeHandler from the observed bean, if the
                // bean is not null. Also removes all listeners from the bean that
                // have been registered with #addBeanPropertyChangeListener before.
                if (isBuffering()) {
                    triggerFlush();
                    resetChanged();
                    System.out.println("RESET action : If changes : Previous restored");
                    PresentationModelBuild.commitButton.setEnabled(false);
                }
            }
        }

        private class ClearAction extends AbstractAction {
            // Not Used

            public ClearAction() {
                super("Clear Form");
            }

            public void actionPerformed(ActionEvent e) {

                PresentationModelBuild.resetButton.setEnabled(false);
                PresentationModelBuild.clearForm();
                System.out.println("clearform");
            }
        }

        private void displayBufferAndBean(String buffering) {
            System.out.println("" + "Result " + buffering + "n"
                    + "-------------------------------------------------n"
                    + "Bufferd values :" + "n"
                    + "Buffered beanvalue name :" + getBufferedValue("name") + "n"
                    + "Buffered beanvalue occupation :"+ getBufferedValue("occupation") + "n"
                    + "" + "n"
                    + "Bean values :" + "n"
                    + "CustomerBean value name :" + customerBean.getName() + "n"
                    + "CustomerBean value occupation :" + customerBean.getOccupation() + "n"
                    + "---------------------------------------------------");
        }
    }



    CustomBeanlaunch.java
    --------------------------------------------------------------------------------------------

    package samples.s01;

    *
     * Copyright (c) 2008 willems piet pwProTech  All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     *   - Redistributions of source code must retain the above copyright
     *     notice, this list of conditions and the following disclaimer.
     *
     *   - Redistributions in binary form must reproduce the above copyright
     *     notice, this list of conditions and the following disclaimer in the
     *     documentation and/or other materials provided with the distribution.
     *
     */

    public class CustomBeanlaunch {

        /**
         * @param args
         */
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            PresentationModelBuild pme = new PresentationModelBuild();
            pme.constructGui();
        }
    }


    RESULTAAT



    Result SEND Bufferd :true :: Not yet committed
    -------------------------------------------------
    Bufferd values :
    Buffered beanvalue name :piet
    Buffered beanvalue occupation :job

    Bean values :
    CustomerBean value name :null
    CustomerBean value occupation :null
    ---------------------------------------------------
    RESET action : If changes : Previous restored
    Result SEND Bufferd :true :: Not yet committed
    -------------------------------------------------
    Bufferd values :
    Buffered beanvalue name :piet
    Buffered beanvalue occupation :job

    Bean values :
    CustomerBean value name :null
    CustomerBean value occupation :null
    ---------------------------------------------------
    Result COMMIT action:
    -------------------------------------------------
    Bufferd values :
    Buffered beanvalue name :piet
    Buffered beanvalue occupation :job

    Bean values :
    CustomerBean value name :piet
    CustomerBean value occupation :job
    ---------------------------------------------------

    Tags :: RiverLayout , JGoodies , Valueholder , bindings, formmodel , model , sample, samples, java

    06-06-2008 om 22:57 geschreven door de makers


    » Reageer (0)
    01-06-2008
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Make a separator for RiverLayout:
    Klik op de afbeelding om de link te volgen








    Make a separator for RiverLayout:

    JFrame frame = new JFrame();
    frame.getContentPane().setLayout(new RiverLayout());
    frame.getContentPane().add("br left",new JLabel("PresentationModel"));
    frame.getContentPane().add("br hfill",separator(Color.RED));
    frame.getContentPane().add("br",comboboxPM);
    frame.getContentPane().add("tab hfill",fieldPM);
    frame.getContentPane().add("br hfill",separator(Color.GRAY));
    frame.getContentPane().add("br left",okButton);
    frame.getContentPane().add("right",revertButton);//DO NOT USE "TAB RIGHT"
    frame.getContentPane().add("br hfill",separator(Color.GRAY));

    ...

     

    private static TextField separator(Color c) {
        TextField separator = new TextField();
        separator.setBackground(c);
        separator.setPreferredSize(new Dimension(20,2));
    return separator;
    }

    01-06-2008 om 00:00 geschreven door de makers


    » Reageer (0)
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Customize combobox (binding JGoodies):: Riverlayout
    Klik op de afbeelding om de link te volgen




    Customized comboboxes :: Riverlayout : JGoodies binding , valueholder



    package samples;

    /*
     * Copyright (c) 2008 - 2008 willems piet pwProTech  All rights reserved.
     *
     * Redistribution and use in source and binary forms, with or without
     * modification, are permitted provided that the following conditions
     * are met:
     *
     *   - Redistributions of source code must retain the above copyright
     *     notice, this list of conditions and the following disclaimer.
     *
     *   - Redistributions in binary form must reproduce the above copyright
     *     notice, this list of conditions and the following disclaimer in the
     *     documentation and/or other materials provided with the distribution.
     *
     *
     * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
     * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
     * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
     * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
     * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
     * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
     * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
     * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
     * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     */

    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Font;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.util.ArrayList;

    import javax.swing.JButton;
    import javax.swing.JComboBox;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.border.EmptyBorder;

    import se.datadosen.component.RiverLayout;

    import com.jgoodies.binding.adapter.BasicComponentFactory;
    import com.jgoodies.binding.adapter.ComboBoxAdapter;
    import com.jgoodies.binding.value.ValueHolder;
    import com.jgoodies.binding.value.ValueModel;

    public class CustomComboAdapter extends JPanel {
        private String CMD_OK = "cmd.ok"/* NOI18N */;

        private JButton okButton;

        public ComboValueHolder ch, cl; // static

        public CustomComboAdapter() {
            JPanel panel = new JPanel(new RiverLayout());
            panel.setBorder(new EmptyBorder(6, 6, 6, 6));
            riverFormBuilder(panel);
            add(panel);
        }

        private void riverFormBuilder(JPanel panel) {
            ArrayList<String> countries = new ArrayList<String>();
            countries.add("England");
            countries.add("Scotland");
            countries.add("Iereland");
            countries.add("Nedtherlands");
            countries.add("Flanders");

            ArrayList<String> languages = new ArrayList<String>();
            languages.add("Dutch");
            languages.add("English");
            languages.add("Spanish");
            languages.add("German");
            languages.add("Russian");
           
            Dimension d = new Dimension(150, 20);
            Font userfont = new Font("Arial",1,12);
           
            ch = new ComboValueHolder();
            ch.setStartselection("Make selection");
            JComboBox countriesComboBoxes = ch.customComboBox(countries, d,userfont,Color.WHITE);

            cl = new ComboValueHolder();
            cl.setStartselection("Spanish");
            JComboBox combolanguageBox = cl.customComboBox(languages, d,userfont,Color.WHITE);
           
            okButton = new JButton();
            okButton.setText("ok");
            okButton.setActionCommand(CMD_OK);
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    // windowAction(event);
                    System.out.println("Combo selection country"
                            + ch.getSelectionHolder().getValue());
                    System.out.println("Combo selection language"
                            + cl.getSelectionHolder().getValue());
                    System.out.println(okButton.getActionCommand());

                }
            });

            panel.add("p", new JLabel("ComboBox Countries:"));
            panel.add("tab hfill", countriesComboBoxes);
            panel.add("tab tab", new JLabel("Selection:"));
            panel.add("tab tab tab hfill", BasicComponentFactory.createTextField(ch
                    .getSelectionHolder()));

            panel.add("p", new JLabel("ComboBox Languages:"));
            panel.add("tab hfill", combolanguageBox);
            panel.add("tab tab", new JLabel("Selection:"));
            panel.add("tab tab tab hfill", BasicComponentFactory.createTextField(cl
                    .getSelectionHolder()));
            panel.add("p hfill", okButton);
        }

        public static void main(String[] a) {
            JFrame f = new JFrame("Custom ComboBox");
            f.setDefaultCloseOperation(2);
            f.add(new CustomComboAdapter());
            f.pack();
            f.setVisible(true);
        }

        public class ComboValueHolder {
            String startselection;

            ValueModel selectionHolder;

            public ValueModel ComboHolder() {
                ValueModel selectionHolder = new ValueHolder(this.startselection);
                setSelectionHolder(selectionHolder);
                return selectionHolder;
            }

            public JComboBox customComboBox(ArrayList countries, Dimension d, Font font, Color color) {

                ComboBoxAdapter comboBoxAdapter = new ComboBoxAdapter(countries,ComboHolder());
                JComboBox comboBox = new JComboBox();
                comboBox.setPreferredSize(d);
                comboBox.setFont(font);
                comboBox.setBackground(color);
                comboBox.setModel(comboBoxAdapter);
                return comboBox;
            }

            public String getStartselection() {
                return startselection;
            }

            public void setStartselection(String startselection) {
                this.startselection = startselection;
            }

            public ValueModel getSelectionHolder() {
                return selectionHolder;
            }

            public void setSelectionHolder(ValueModel selectionHolder) {
                this.selectionHolder = selectionHolder;
            }

        }
    }


    Tags :: RiverLayout , JGoodies , Valueholder , bindings, formmodel , model , sample, samples, java

    01-06-2008 om 00:00 geschreven door de makers


    » Reageer (0)
    29-05-2008
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Test Riverlayout :: sample


     
    Project Test Riverlayout :: working example jgoodies binding remove and load jpanels

    Test RiverLayout :: (pics dir: see bottom)

    Package beans
    1.SingleForm.java
    2.TripleForm.java

    Package forms.masterforms
    1.SingleMasterForm.java
    2.TripleMasterForm.java

    Package se.datadosen
    > Download riverlayout.zip


    Package src
    1.MenuBar.java
    2.OpeningForm.java


    Package testen
    1.RiverLayoutTest.java

     
    CODE:
    SingleForm.java
    package beans;
    /*
    * Copyright (c) 2008 - 2008 willems piet pwProTech All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * - Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * - Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    import com.jgoodies.binding.beans.Model;
    //This configuration is more advanced then the tripleform bean and uses JGoodies beans.model
    public class SingleForm extends Model {
    String name, street, nr, towncity, occupation;
    	public String getName() {
    return name;
    }
    	public void setName(String name) {
    this.name = name;
    }
    	public String getNr() {
    return nr;
    }
    	public void setNr(String nr) {
    this.nr = nr;
    }
    	public String getOccupation() {
    return occupation;
    }
    	public void setOccupation(String occupation) {
    this.occupation = occupation;
    }
    	public String getStreet() {
    return street;
    }
    	public void setStreet(String street) {
    this.street = street;
    }
    	public String getTowncity() {
    return towncity;
    }
    	public void setTowncity(String towncity) {
    this.towncity = towncity;
    }
    }
    
    TripleForm.java
    package beans;
    /*
    * Copyright (c) 2008 - 2008 willems piet pwProTech All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * - Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * - Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    import java.beans.PropertyChangeListener;
    import com.jgoodies.binding.beans.ExtendedPropertyChangeSupport;
    public class TripleForm {
    	//ToDo :: see singlemasterform : extends Model
    	String username, age, comment;
    	boolean menuItemEnabled;
    	private ExtendedPropertyChangeSupport changeSupport = new ExtendedPropertyChangeSupport(
    this);
    	public String getUsername() {
    return username;
    }
    	public void setUsername(String username) {
    String oldValue = username;
    this.username = username;
    changeSupport.firePropertyChange("stringValue", oldValue, username);
    System.out.println(username);
    }
    	public String getAge() {
    return age;
    }
    	public void setAge(String age) {
    String oldValue = age;
    this.age = age;
    changeSupport.firePropertyChange("stringValue", oldValue, age);
    System.out.println(age);
    }
    	public String getComment() {
    return comment;
    }
    	public void setComment(String comment) {
    String oldValue = comment;
    this.comment = comment;
    changeSupport.firePropertyChange("stringValue", oldValue, comment);
    System.out.println(comment);
    }
    	public void addPropertyChangeListener(PropertyChangeListener x) {
    changeSupport.addPropertyChangeListener(x);
    }
    	public void removePropertyChangeListener(PropertyChangeListener x) {
    changeSupport.removePropertyChangeListener(x);
    }
    	public boolean isMenuItemEnabled() {
    return menuItemEnabled;
    }
    	public void setMenuItemEnabled(boolean menuItemEnabled) {
    this.menuItemEnabled = menuItemEnabled;
    }
    }
     
    
    SingleMasterForm.java
    package forms.masterforms;
    /*
    * Copyright (c) 2008 - 2008 willems piet pwProTech All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * - Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * - Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JMenuItem;
    import javax.swing.JPanel;
    import javax.swing.JTextField;
    import se.datadosen.component.RiverLayout;
    import src.MenuBar;
    import beans.SingleForm;
    import com.jgoodies.binding.adapter.BasicComponentFactory;
    import com.jgoodies.binding.beans.BeanAdapter;
    import com.jgoodies.binding.value.ValueModel;
    import com.jgoodies.forms.factories.Borders;
    public class SingleMasterForm {
    	private String CMD_OK = "cmd.ok"/* NOI18N */;
    	private JButton okButton;
    	public JPanel buildform(final JFrame f, final JMenuItem menuitem) {
    okButton = new JButton();
    okButton.setText("ok");
    okButton.setActionCommand(CMD_OK);
    okButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent event) {
    // windowAction(event);
    System.out
    .println("ACTION : BUTTON OK WAS CLICKED and Menu item enabled");
    System.out.println(okButton.getActionCommand());
    menuitem.setEnabled(true);//and close
    MenuBar.FrameClearAction(f);
    }
    });
    		SingleForm bean = new SingleForm();
    BeanAdapter adapter = new BeanAdapter(bean, true);
    		ValueModel nameModel = adapter.getValueModel("name");
    ValueModel streetModel = adapter.getValueModel("street");
    ValueModel nrModel = adapter.getValueModel("nr");
    ValueModel towncityModel = adapter.getValueModel("towncity");
    ValueModel occupationModel = adapter.getValueModel("occupation");
    		JTextField nameinput = BasicComponentFactory.createTextField(nameModel);
    JTextField streetinput = BasicComponentFactory
    .createTextField(streetModel);
    JTextField nrinput = BasicComponentFactory.createTextField(nrModel);
    JTextField towncityinput = BasicComponentFactory
    .createTextField(towncityModel);
    JTextField occupationinput = BasicComponentFactory
    .createTextField(occupationModel);
    		// Panel
    		// SingleMasterForm
    JPanel SingleMasterForm = new JPanel();
    SingleMasterForm.setLayout(new RiverLayout());
    SingleMasterForm.add("right", new JLabel("Single Form demo"));
    SingleMasterForm.add("p left", new JLabel("Name"));
    SingleMasterForm.add("tab hfill", nameinput);
    SingleMasterForm.add("br", new JLabel("Street"));
    SingleMasterForm.add("tab hfill", streetinput);
    SingleMasterForm.add("br vtop", new JLabel("nr"));
    SingleMasterForm.add("tab", nrinput);
    nrinput.setColumns(5);
    SingleMasterForm.add("br vtop", new JLabel("Town/City"));
    SingleMasterForm.add("tab hfill", towncityinput);
    SingleMasterForm.add("br vtop", new JLabel("Occupation"));
    SingleMasterForm.add("tab hfill", occupationinput);
    SingleMasterForm.add("p right", okButton);
    SingleMasterForm.setBorder(Borders.DIALOG_BORDER);
    		return SingleMasterForm;
    }
    }
     
    
    TripleMasterForm.java
    
    package forms.masterforms;
    /*
    * Copyright (c) 2008 - 2008 willems piet pwProTech All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * - Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * - Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JMenuItem;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JSplitPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.border.EmptyBorder;
    import se.datadosen.component.RiverLayout;
    import src.MenuBar;
    import beans.TripleForm;
    import com.jgoodies.binding.adapter.BasicComponentFactory;
    import com.jgoodies.binding.beans.BeanAdapter;
    import com.jgoodies.binding.value.ValueModel;
    import com.jgoodies.forms.factories.Borders;
    public class TripleMasterForm extends TripleForm {
    	private String CMD_OK = "cmd.ok"/* NOI18N */;
    	private JButton okButton, ok1Button, ok2Button;
    	public JPanel formRegistration(final JFrame f, final JMenuItem menuitem) {
    okButton = new JButton();
    okButton.setText("ok");
    okButton.setActionCommand(CMD_OK);
    		okButton.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent event) {
    // windowAction(event);
    System.out
    .println("ACTION : BUTTON OK WAS CLICKED and menu item enabled");
    System.out.println(okButton.getActionCommand());
    menuitem.setEnabled(true);//and close
    MenuBar.FrameClearAction(f);
    }
    });
    		ok1Button = new JButton();
    ok1Button.setText("ok 1");
    ok1Button.setActionCommand(CMD_OK);
    ok1Button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent event) {
    // windowAction(event);
    System.out.println("ACTION : BUTTON 1 OK WAS CLICKED");
    System.out.println(ok1Button.getActionCommand());
    menuitem.setEnabled(true);//and close
    MenuBar.FrameClearAction(f);
    }
    });
    		ok2Button = new JButton(); // we'll need this soon
    ok2Button.setText("ok 2");
    ok2Button.setActionCommand(CMD_OK);
    ok2Button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent event) {
    // windowAction(event);
    System.out.println("ACTION : BUTTON 2 OK WAS CLICKED");
    System.out.println(ok2Button.getActionCommand());
    menuitem.setEnabled(true);//and close
    MenuBar.FrameClearAction(f);
    }
    });
    		TripleForm bean = new TripleForm();
    BeanAdapter adapter = new BeanAdapter(bean, true);
    		ValueModel nameModel = adapter.getValueModel("username");
    ValueModel ageModel = adapter.getValueModel("age");
    ValueModel commentModel = adapter.getValueModel("comment");
    		JTextField userinput = BasicComponentFactory.createTextField(nameModel);
    JTextField ageinput = BasicComponentFactory.createTextField(ageModel);
    JTextArea commentinput = BasicComponentFactory
    .createTextArea(commentModel);
    		ValueModel nameModel01 = adapter.getValueModel("username");
    ValueModel ageModel01 = adapter.getValueModel("age");
    ValueModel commentModel01 = adapter.getValueModel("comment");
    		JTextField userinput01 = BasicComponentFactory
    .createTextField(nameModel01);
    JTextField ageinput01 = BasicComponentFactory
    .createTextField(ageModel01);
    JTextArea commentinput01 = BasicComponentFactory
    .createTextArea(commentModel01);
    		ValueModel nameModel02 = adapter.getValueModel("username");
    ValueModel ageModel02 = adapter.getValueModel("age");
    ValueModel commentModel02 = adapter.getValueModel("comment");
    		JTextField userinput02 = BasicComponentFactory
    .createTextField(nameModel02);
    JTextField ageinput02 = BasicComponentFactory
    .createTextField(ageModel02);
    JTextArea commentinput02 = BasicComponentFactory
    .createTextArea(commentModel02);
    		// Panel 1 = left + center
    		// left
    JPanel left = new JPanel();
    left.setLayout(new RiverLayout());
    left.add("right", new JLabel("Registration form left"));
    left.add("p left", new JLabel("Name"));
    left.add("tab hfill", userinput);
    left.add("br", new JLabel("Age"));
    ageinput.setColumns(5);
    left.add("tab", ageinput);
    left.add("br vtop", new JLabel("Comment"));
    commentinput.setRows(3);
    left.add("tab hfill vfill", new JScrollPane(commentinput));
    left.add("p right", okButton);
    // added to level the content of the 3 panels
    left.setBorder(Borders.DIALOG_BORDER);
    		// center
    JPanel center = new JPanel();
    center.setLayout(new RiverLayout());
    center.add("right", new JLabel("Registration form center"));
    center.add("p left", new JLabel("Name-center"));
    center.add("tab hfill", userinput01);
    center.add("br", new JLabel("Age-center"));
    ageinput01.setColumns(2);
    center.add("tab", ageinput01);
    center.add("br vtop", new JLabel("Comment-center"));
    center.add("tab hfill vfill", new JScrollPane(commentinput01));
    center.add("p right", ok1Button);
    center.add(left);
    // added to level the content of the 3 panels
    center.setBorder(Borders.DIALOG_BORDER);
    		JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
    left, center);
    JPanel panel1 = new JPanel();
    panel1.setLayout(new RiverLayout());
    splitPane.setBorder(new EmptyBorder(-10, -5, -20, -8));
    //splitPane.setDividerLocation(150);
    //splitPane.setOneTouchExpandable(true);
    splitPane.setDividerSize(3);
    panel1.add("hfill vfill", splitPane);
    		JPanel right = new JPanel();
    right.setLayout(new RiverLayout());
    right.add("right", new JLabel("Registration form right"));
    right.add("p left", new JLabel("Name-right"));
    right.add("tab hfill", userinput02);
    right.add("br", new JLabel("Age-right"));
    ageinput02.setColumns(3);
    right.add("tab", ageinput02);
    right.add("br vtop", new JLabel("Comment-right"));
    right.add("tab hfill vfill", new JScrollPane(commentinput02));
    right.add("p right", ok2Button);
    // added to level the content of the 3 panels
    right.setBorder(new EmptyBorder(6, 0, 6, 0));
    		JSplitPane splitPane0 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
    panel1, right);
    		splitPane0.setBorder(new EmptyBorder(-4, 0, -10, 0));
    splitPane0.setDividerSize(3);
    		//RegistrationMasterForm
    		JPanel masterform = new JPanel();
    masterform.setLayout(new RiverLayout());
    masterform.add("vfill hfill", splitPane0);
    		return masterform;
    }
    }
     
    
    MenuBar.java
    package src;
    /*
    * Copyright (c) 2008 - 2008 willems piet pwProTech All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * - Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * - Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.KeyEvent;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JMenu;
    import javax.swing.JMenuBar;
    import javax.swing.JMenuItem;
    import javax.swing.KeyStroke;
    import se.datadosen.component.RiverLayout;
    import forms.masterforms.SingleMasterForm;
    import forms.masterforms.TripleMasterForm;
    public class MenuBar {
    protected JMenuBar menuBar;
    	public JMenuBar MenuBarRegistration(JFrame frame) {
    //send to where the GUI is created:
    //Call : frame.setJMenuBar( MenuBarRegistration(frame));
    		JMenu menu, submenu;
    JMenuItem menuItem1, menuItem2, menuItem3, menuItem4, menuItem5, menuItem51, menuItem52;
    		//Create the menu bar.
    menuBar = new JMenuBar();
    		//Build the first menu.
    menu = new JMenu("TestMenu 1");
    menu.setMnemonic(KeyEvent.VK_A);
    //menu.getAccessibleContext().setAccessibleDescription(
    // "The only menu in this program that has menu items");
    menuBar.add(menu);
    		//a group of JMenuItems
    menuItem1 = new JMenuItem("Clear test", KeyEvent.VK_T);
    menuItem1.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1,
    ActionEvent.ALT_MASK));
    menuItem1.setName("een");
    menu.add(menuItem1);
    		//  Text - icon sample
    menuItem2 = new JMenuItem("Single form", new ImageIcon(
    "images/yourpic.gif"));
    		menuItem2.setMnemonic(KeyEvent.VK_B);
    menuItem2.setName("singlemasterform");
    menu.add(menuItem2);
    		menuItem3 = new JMenuItem("Triple form", new ImageIcon(
    "images/yourpic.gif"));
    menuItem3.setMnemonic(KeyEvent.VK_B);
    menuItem3.setName("twee");
    menu.add(menuItem3);
    		menuItem5 = new JMenuItem(new ImageIcon("images/yourpic.gif"));
    //Only icon dample
    menuItem5.setMnemonic(KeyEvent.VK_D);
    menu.add(menuItem3);
    		//a submenu
    menu.addSeparator();
    submenu = new JMenu("Submenu sample");
    submenu.setMnemonic(KeyEvent.VK_S);
    		menuItem51 = new JMenuItem("Submenu item 1 sample");
    menuItem51.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2,
    ActionEvent.ALT_MASK));
    submenu.add(menuItem51);
    		menuItem52 = new JMenuItem("Submenu item 2 sample");
    submenu.add(menuItem52);
    menu.add(submenu);
    		//Build second menu in the menu bar.
    menu = new JMenu("TestMenu 2");
    menu.setMnemonic(KeyEvent.VK_N);
    menuBar.add(menu);
    		//Adding action listener to menu items
    //------------------------------------
    menuAction(menuItem1, frame);
    menuAction(menuItem2, frame);
    menuAction(menuItem3, frame);
    		menuItem51.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    System.out.println("SubmenuItem 1 is pressed");
    }
    });
    menuItem52.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    System.out.println("SubmenuItem 2 is pressed");
    }
    });
    		return menuBar;
    	}
    	private void menuAction(final JMenuItem menuItem, final JFrame f) {
    menuItem.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    String action = menuItem.getName();
    System.out.println("action" + action);
    if (action.equals("een")) {
    menuSelectionClearContentPane(f);
    } else if (action.equals("twee")) {
    menuSelectionTripleMasterForm(menuItem, f);
    } else if (action.equals("singlemasterform")) {
    menuSelectionSingleMasterForm(menuItem, f);
    }
    }
    			private void menuSelectionClearContentPane(final JFrame f) {
    enableItemsMenu0();
    FrameClearAction(f);
    System.out.println(f.getName() + " is Cleared");
    }
    			private void menuSelectionSingleMasterForm(
    final JMenuItem menuItem, final JFrame f) {
    enableItemsMenu0();
    menuItem.setEnabled(false);
    f.getContentPane().removeAll();
    SingleMasterForm smf = new SingleMasterForm();
    f.setLayout(new RiverLayout());
    f.getContentPane().add("hfill vfill",
    smf.buildform(f, menuItem));
    System.out.println(f.getName() + " is installed");
    f.validate();
    f.repaint();
    }
    			private void menuSelectionTripleMasterForm(
    final JMenuItem menuItem, final JFrame f) {
    enableItemsMenu0();
    menuItem.setEnabled(false);
    f.getContentPane().removeAll();
    TripleMasterForm rmf = new TripleMasterForm();
    rmf.setMenuItemEnabled(false);
    f.setLayout(new RiverLayout());
    f.getContentPane().add("hfill vfill",
    rmf.formRegistration(f, menuItem));
    System.out.println(f.getName() + " is installed");
    f.validate();
    f.repaint();
    }
    			private void enableItemsMenu0() {
    //ToDo name the item indexes
    getMenuItem(0, 0).setEnabled(true);
    getMenuItem(0, 1).setEnabled(true);
    getMenuItem(0, 2).setEnabled(true);
    }
    });
    }
    	public static void FrameClearAction(JFrame f) {
    		f.getContentPane().removeAll();
    f.getContentPane().setLayout(new RiverLayout());
    f.getContentPane().add(new JLabel("Frame Cleared"));
    f.validate();
    f.repaint();
    		System.out.println("pass" + f.getContentPane().getComponents());
    }
    	protected JMenuItem getMenuItem(int menuIndex, int itemIndex) {
    //JMenuBar menuBar;
    JMenu menu = menuBar.getMenu(menuIndex);
    System.out.println(menu.getName());
    return menu.getItem(itemIndex);
    }
    }
     
    OpeningForm.java
    
    package src;
    /*
    * Copyright (c) 2008 - 2008 willems piet pwProTech All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * - Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * - Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    import java.awt.Dimension;
    import java.awt.Font;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import se.datadosen.component.RiverLayout;
    public class OpeningForm {
    public static JPanel buildForm() {
    JPanel openingPanel = new JPanel();
    openingPanel.setLayout(new RiverLayout());

            JLabel infoLabel = new JLabel();
    JLabel gapLabel = new JLabel();
            gapLabel.setPreferredSize(new Dimension(150, 240));
    infoLabel.setPreferredSize(new Dimension(400, 240));
    infoLabel.setFont(new Font("sansserif", Font.BOLD, 32));
    infoLabel.setText("Test Riverlayout");
    openingPanel.add("p" , gapLabel);
    openingPanel.add("tab" , infoLabel);
    return openingPanel;
    }
    }
     
    
    RiverLayoutTest.java
    package testen;
    /*
    * Copyright (c) 2008 - 2008 willems piet pwProTech All rights reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
    * are met:
    *
    * - Redistributions of source code must retain the above copyright
    * notice, this list of conditions and the following disclaimer.
    *
    * - Redistributions in binary form must reproduce the above copyright
    * notice, this list of conditions and the following disclaimer in the
    * documentation and/or other materials provided with the distribution.
    *
    *
    * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
    * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
    * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
    * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
    * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
    * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
    * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
    * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
    * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    */
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import com.jgoodies.forms.factories.Borders;
    import beans.TripleForm;
    import se.datadosen.component.RiverLayout;
    import src.MenuBar;
    /* TopLevelDemo.java requires no other files. */
    public class RiverLayoutTest {
    /**
    * Create the GUI and show it.
    */
    private static void createAndShowGUI() {
    //Create and set up the window.
    JFrame frame = new JFrame("Test Layout");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.getContentPane().setLayout(new RiverLayout());
    		//Set the menu bar and add the openingForm to the content pane.
    frame.setJMenuBar(new MenuBar().MenuBarRegistration(frame));
    frame.getContentPane().add("hfill", src.OpeningForm.buildForm());
    		//Display the window.
    frame.setLocation(150, 200);
    frame.pack();
    frame.setVisible(true);
    }
    	public static void main(String[] args) {
    //creating and showing this application's GUI.
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    }
    });
    }
    }

    Tags : RiverLayout , sample , java , example , jgoodies , valuemodel, model

     


    29-05-2008 om 00:00 geschreven door de makers


    » Reageer (0)
    20-05-2008
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Project pw Helpdesk
    Klik op de afbeelding om de link te volgen



    Started with new project helpdesk:




    -basic layout : see pic

    -todo :  treeview final configuration
    -todo : create searchpanel
    -todo : create tabpane » reflecting search
    -todo : implement riverlayout as a test.

    20-05-2008 om 12:44 geschreven door de makers


    » Reageer (0)
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.LookAndFeel
    Klik op de afbeelding om de link te volgen



    LookAndFeel




    To change the lookandfeel for example to "windowslookandfeel" you will have to add
    UIManager.setLookAndFeel to your code :: see sample

    buildregistration.java  [ full example code :  see 19-05-2008 ]

    package formbuilding;

    import javax.swing.JFrame;
    import javax.swing.UIManager;
    import javax.swing.UnsupportedLookAndFeelException;

    import formbeans.Registration;

    public class BuildRegistration {

        public BuildRegistration(String title) {
            JFrame f = new JFrame(title);
            try {
                UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
            } catch (ClassNotFoundException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (InstantiationException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            } catch (UnsupportedLookAndFeelException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
            Registration r = new Registration();
            f.setLocation(200, 200);
            r.formRiverLayout(f);
            f.pack();
            f.setVisible(true);

        }

        public static void main(String[] args) {
            BuildRegistration br = new BuildRegistration("Registration");

        }
    }

    20-05-2008 om 00:00 geschreven door de makers


    » Reageer (0)
    19-05-2008
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.JGoodies binding - RiverLayout
    Klik op de afbeelding om de link te volgen





    A working example: JGoodies binding - RiverLayout


    1: Registration.java


    package formbeans;

    import java.awt.Container;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.beans.PropertyChangeListener;

    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JPanel;
    import javax.swing.JScrollPane;
    import javax.swing.JSplitPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;
    import javax.swing.border.EmptyBorder;

    import se.datadosen.component.RiverLayout;

    import com.jgoodies.binding.adapter.BasicComponentFactory;
    import com.jgoodies.binding.beans.BeanAdapter;
    import com.jgoodies.binding.beans.ExtendedPropertyChangeSupport;
    import com.jgoodies.binding.value.ValueModel;
    import com.jgoodies.forms.factories.Borders;

    public class Registration {

        String username, age, comment;
     
        private String CMD_OK = "cmd.ok"/* NOI18N */;
        private JButton okButton, ok1Button, ok2Button;
        private ExtendedPropertyChangeSupport changeSupport = new ExtendedPropertyChangeSupport(
                this);

        public String getUsername() {
            return username;
        }

        public void setUsername(String username) {
            String oldValue = username;
            this.username = username;
            changeSupport.firePropertyChange("stringValue", oldValue, username);
            System.out.println(username);
        }

        public String getAge() {
            return age;
        }

        public void setAge(String age) {
            String oldValue = age;
            this.age = age;
            changeSupport.firePropertyChange("stringValue", oldValue, age);
            System.out.println(age);
        }

        public String getComment() {
            return comment;
        }

        public void setComment(String comment) {
            String oldValue = comment;
            this.comment = comment;
            changeSupport.firePropertyChange("stringValue", oldValue, comment);
            System.out.println(comment);
        }

        public void addPropertyChangeListener(PropertyChangeListener x) {
            changeSupport.addPropertyChangeListener(x);
        }

        public void removePropertyChangeListener(PropertyChangeListener x) {
            changeSupport.removePropertyChangeListener(x);
        }

        public Container formRiverLayout(JFrame f) {
            okButton = new JButton();
            okButton.setText("ok");
            okButton.setActionCommand(CMD_OK);
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    // windowAction(event);
                    System.out.println("ACTION : BUTTON OK WAS CLICKED");
                    System.out.println(okButton.getActionCommand());
                }
            });

            ok1Button = new JButton();
            ok1Button.setText("ok 1");
            ok1Button.setActionCommand(CMD_OK);
            ok1Button.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    // windowAction(event);
                    System.out.println("ACTION : BUTTON 1 OK WAS CLICKED");
                    System.out.println(ok1Button.getActionCommand());
                }
            });

            ok2Button = new JButton(); // we'll need this soon
            ok2Button.setText("ok 2");
            ok2Button.setActionCommand(CMD_OK);
            ok2Button.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    // windowAction(event);
                    System.out.println("ACTION : BUTTON 2 OK WAS CLICKED");
                    System.out.println(ok2Button.getActionCommand());
                }
            });

            Registration bean = new Registration();
            BeanAdapter adapter = new BeanAdapter(bean, true);

            ValueModel nameModel = adapter.getValueModel("username");
            ValueModel ageModel = adapter.getValueModel("age");
            ValueModel commentModel = adapter.getValueModel("comment");

            JTextField userinput = BasicComponentFactory.createTextField(nameModel);
            JTextField ageinput = BasicComponentFactory.createTextField(ageModel);
            JTextArea commentinput = BasicComponentFactory
                    .createTextArea(commentModel);

            ValueModel nameModel01 = adapter.getValueModel("username");
            ValueModel ageModel01 = adapter.getValueModel("age");
            ValueModel commentModel01 = adapter.getValueModel("comment");

            JTextField userinput01 = BasicComponentFactory
                    .createTextField(nameModel01);
            JTextField ageinput01 = BasicComponentFactory
                    .createTextField(ageModel01);
            JTextArea commentinput01 = BasicComponentFactory
                    .createTextArea(commentModel01);

            ValueModel nameModel02 = adapter.getValueModel("username");
            ValueModel ageModel02 = adapter.getValueModel("age");
            ValueModel commentModel02 = adapter.getValueModel("comment");

            JTextField userinput02 = BasicComponentFactory
                    .createTextField(nameModel02);
            JTextField ageinput02 = BasicComponentFactory
                    .createTextField(ageModel02);
            JTextArea commentinput02 = BasicComponentFactory
                    .createTextArea(commentModel02);

            // Panel 1 = left + center

            // left
            JPanel left = new JPanel();
            left.setLayout(new RiverLayout());
            left.add("right", new JLabel("Registration form left"));
            left.add("p left", new JLabel("Name"));
            left.add("tab hfill", userinput);
            left.add("br", new JLabel("Age"));
            ageinput.setColumns(5);
            left.add("tab", ageinput);
            left.add("br vtop", new JLabel("Comment"));
            commentinput.setRows(3);
            left.add("tab hfill vfill", new JScrollPane(commentinput));
            left.add("p right", okButton);
            // added to level the content of the 3 panels
            left.setBorder(Borders.DIALOG_BORDER);

            // center
            JPanel center = new JPanel();
            center.setLayout(new RiverLayout());
            center.add("right", new JLabel("Registration form center"));
            center.add("p left", new JLabel("Name-center"));
            center.add("tab hfill", userinput01);
            center.add("br", new JLabel("Age-center"));
            ageinput01.setColumns(2);
            center.add("tab", ageinput01);
            center.add("br vtop", new JLabel("Comment-center"));
            center.add("tab hfill vfill", new JScrollPane(commentinput01));
            center.add("p right", ok1Button);
            center.add(left);
            // added to level the content of the 3 panels
            center.setBorder(Borders.DIALOG_BORDER);

            JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                    left, center);
            JPanel panel1 = new JPanel();
            panel1.setLayout(new RiverLayout());
            splitPane.setBorder(new EmptyBorder(-10, -5, -20, -8));
            //splitPane.setDividerLocation(150);
            //splitPane.setOneTouchExpandable(true);
            splitPane.setDividerSize(3);
            panel1.add("hfill vfill", splitPane);

            JPanel right = new JPanel();
            right.setLayout(new RiverLayout());
            right.add("right", new JLabel("Registration form right"));
            right.add("p left", new JLabel("Name-right"));
            right.add("tab hfill", userinput02);
            right.add("br", new JLabel("Age-right"));
            ageinput02.setColumns(3);
            right.add("tab", ageinput02);
            right.add("br vtop", new JLabel("Comment-right"));
            right.add("tab hfill vfill", new JScrollPane(commentinput02));
            right.add("p right", ok2Button);
            // added to level the content of the 3 panels
            right.setBorder(new EmptyBorder(6, 0, 6, 0));

            JSplitPane splitPane0 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT,
                    panel1, right);

            splitPane0.setBorder(new EmptyBorder(-4, 0, -10, 0));
            splitPane0.setDividerSize(3);

            Container c = f.getContentPane();

            c.add(splitPane0);
            // to add a gray border change the code to :
            // c.setBackground(Color.GRAY);
            // c.setLayout(new RiverLayout());
            // c.add("hfill vfill",splitPane0);
            return c;
        }
    }






    2.BuildRegistration.java

    package formbuilding;

    import javax.swing.JFrame;
    import formbeans.Registration;

    public class BuildRegistration {

        public BuildRegistration(String title) {
            JFrame f = new JFrame(title);

            Registration r = new Registration();
            f.setLocation(200, 200);
            r.formRiverLayout(f);
            f.pack();
            f.setVisible(true);

        }

        public static void main(String[] args) {
            BuildRegistration br = new BuildRegistration("Registration");

        }

    }

    <hr>
    <pre><font face="Arial">Tags : RiverLaout , sample , java , example , jgoodies , valuemodel</font></pre><hr>

    19-05-2008 om 00:00 geschreven door de makers


    » Reageer (1)
    18-05-2008
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.JGoodies binding and RiverLayout
    How to define the length of a JTextField by using the RiverLayout - a simple and flexible Java Layout Manager- and the JGoodies binding


    sample:

    imports :

    import java.awt.Container;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.beans.PropertyChangeListener;

    import javax.swing.JButton;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    import javax.swing.JScrollPane;
    import javax.swing.JTextArea;
    import javax.swing.JTextField;

    import com.jgoodies.binding.adapter.BasicComponentFactory;
    import com.jgoodies.binding.beans.BeanAdapter;
    import com.jgoodies.binding.beans.ExtendedPropertyChangeSupport;
    import com.jgoodies.binding.value.ValueModel;

    import se.datadosen.component.RiverLayout;

    ...


        public Container formRiverLayout(JFrame f) {
            okButton = new JButton();
            okButton.setText("ok");
            okButton.setActionCommand(CMD_OK);
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    // windowAction(event);
                    System.out.println("ACTION : BUTTON OK WAS CLICKED");
                    System.out.println(okButton.getActionCommand());
                }
            });

            Registration bean = new Registration();
            BeanAdapter adapter = new BeanAdapter(bean, true);

            ValueModel nameModel = adapter.getValueModel("username");
            ValueModel ageModel = adapter.getValueModel("age");
            ValueModel commentModel = adapter.getValueModel("comment");

            JTextField userinput = BasicComponentFactory.createTextField(nameModel);
            JTextField ageinput = BasicComponentFactory.createTextField(ageModel);
            ageinput.setColumns(3);
            // When this configuration isn't done the BasicComponentFactory
            //will not configure the width and the  JTextField will be redused to
            //a few millimeter.

            JTextArea commentinput = BasicComponentFactory.createTextArea(commentModel);

            Container c = f.getContentPane();
                c.setLayout(new RiverLayout());
                c.add("right", new JLabel("Registration form"));
                c.add("p left", new JLabel("Name"));
                c.add("tab hfill", userinput);
                c.add("br", new JLabel("Age"));
                c.add("tab", ageinput);
                c.add("br vtop", new JLabel("Comment"));
                c.add("tab hfill vfill", new JScrollPane(commentinput));
                c.add("p center", okButton);
            return c;
        }


    18-05-2008 om 00:00 geschreven door de makers


    » Reageer (0)
    02-02-2008
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Enkele JAVA gebonden afkortingen

    JAVA gebonden afkortingen
    ORM
    JSP
    JSF
    MVC
    J2EE
    J2SE
    POJO
    Object-Relational mapping
    JavaServer Pages
    JavaServer Faces
    Model-view-controller
    Java 2 Platform Enterprise Edition
    Java 2 Platform, Standard Edition
    Plain Old Java Object
    JTA
    EJB
    API
    AOP
    JDBC
    Java Transaction API
    Enterprise JavaBeans
    Application programming interface
    Aspect-oriented programming
    Java Database Connectivity
    SQL
    HQL
    JDO
    DAO
    Structured Query Language
    Hibernate Query Language
    Java Data Objects
    Data Access Object
    iBATIS is a persistence framework which enables mapping SQL queries to POJOs
    Apache Struts is an open-source web application framework for developing Java EE web applications.
    WebWork is a Java-based web application framework developed by OpenSymphony.
    Tapestry is an open-source framework for creating dynamic, robust, highly scalable web applications in Java.
    TopLink is an object-relational mapping package for Java developers.
    Hibernate is an object-relational mapping (ORM) library for the Java language, providing a framework for mapping an object-oriented domain model to a traditional relational database.
    Spring Spring is a layered Java/J2EE application framework, based on code published in Expert One-on-One J2EE Design and Development by Rod Johnson (Wrox, 2002).


    02-02-2008 om 15:59 geschreven door de makers


    » Reageer (0)
    21-11-2007
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Java Persistence with Hibernate

    Java Persistence with Hibernate 
                Schermbreed weergeven : klik voorlaatste ikoon van toolbalk


    21-11-2007 om 21:50 geschreven door de makers


    » Reageer (1)
    12-11-2007
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Exel : Woorden vervangen in tekst m.b..v een macro

    Macro voor excel om een lijst woorden in één keer te vervangen in een tekst.


    De code voor Visual Basic macro "Vervang"

    De lijst woorden die men wenst te vervangen bevindt zich in dit voorbeeld in de kolom C4 tot C13.De wisselwoorden in de kolom daarnaast [Offset(0, 1)].


    Sub Vervang()

    'author piet :: pwProTech

    For Each c In Worksheets(1).Range("C4:C13")
    Sheets("Blad2").Cells.Replace What:=c.Value, Replacement:=c.Offset(0, 1).Value, LookAt:=xlPart _
    , SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
    ReplaceFormat:=False
    Next c

    End Sub


    De inhoud van excel Blad1
    Range C4 tot C13 :
    Hier plaats je de woorden die je wil vervangen en de veervangtekst

    Vb.:Blad1:

    Op dit blad kan je ook de knop [VERVANG] (die de macro "Vervang" start) aanbrengen.:

    A B C D ...
    1        
    2        
    3   Te vervangen: met:  
    4   Event DB_action  
    5   event db_action  
    ...    ...  ...  


    De inhoud van excel Blad2


    Op Blad2 plaats je de tekst die bewerkt moet worden.

    Je plakt best de hele tekst in één enkele cel zodat je hem weer gemakelijk kan copiëren
    Hoe : dubbele klik in de cel die je verkiest en plakken


    Noot: Je kan ook een knop voorzien om de woorden op "Blad1" te verwijderen met de macro "Reset"

    Code:


    Sub Reset()

      'author piet :: pwProTech

      For Each c In Worksheets(1).Range("C4:C13")
         c.Value = ""
         c.Offset(0, 1).Value = ""
      Next c

    End Sub

    12-11-2007 om 21:21 geschreven door de makers


    » Reageer (0)
    20-10-2007
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Systray : verwijderen tags taakbalk. Wijzigingen start programma's
    Systray : verwijderen tags ( icoon ) taakbalk . Wijzigingen start programma's enz.


    1Ga naar start

    2.Klik op "Uitvoeren" [run] in het geopend menu.
    3.Type in de ingavebalk : msconfig
    4.Klik ok

    Het venster "Hulpprogramma voor systeemconfiguratie" wordt geopend.

    5.In het gegeven venster kan je nu de nodige veranderingen doorvoeren.

    Tip :Programma's met "onbekend" als leverancier of "" (prog's die geen indentificartie hebben) zijn dikwijls dubieus tenzij je natuurlijk het programma kent of het zelf geinstalleerd hebt.

    Noot
    -icoons taakbalk bevinden zich onder de tab "Opstarten"
    -wat bvb. het icoon van het gevaarlijke "antivirusgear" betreft : het bevat in de tab "opstarten" geen gegevens.Het kan wel via deze weg verwijderd worden doch het programma zelf moet apart verwijderd worden.

    20-10-2007 om 00:00 geschreven door de makers


    » Reageer (0)
    27-08-2007
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Scholier kraakt pornofilter van 50 miljoen euro

    Scholier kraakt pornofilter van 50 miljoen euro

    De Morgen   ::
      
    KLIK HIER en LEES MEER

    27-08-2007 om 14:55 geschreven door de makers


    » Reageer (0)
    25-08-2007
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Items Kantorenproject
     

    Project :: Kantoren :: Items

  • Minimumindeling van het algemeen rekeningstelsel MAR Databesetabel voor MySQL
  • 25-08-2007 om 14:41 geschreven door de makers


    » Reageer (0)
    24-08-2007
    Klik hier om een link te hebben waarmee u dit artikel later terug kunt lezen.Minimumindeling van het algemeen rekeningstelsel
    Minimumindeling van het algemeen rekeningstelsel MAR Databasetabel voor MySQL

    -- phpMyAdmin SQL Dump
    -- version 2.6.1-pl3
    -- http://www.phpmyadmin.net
    --
    -- Host: localhost
    -- Generatie Tijd: 25 Aug 2007 om 14:28
    -- Server versie: 5.0.24
    -- PHP Versie: 5.0.3
    --
    -- Database: `boekhouding`
    --

    -- --------------------------------------------------------

    --
    -- Tabel structuur voor tabel `rekeningstelsel`
    --

    CREATE TABLE `rekeningstelsel` (
      `id` int(11) NOT NULL auto_increment,
      `rekening` varchar(8) NOT NULL,
      `beschrijving` varchar(255) default NULL,
      `code1` varchar(8) default NULL,
      `code` varchar(25) default NULL,
      `APR` char(1) NOT NULL,
      `bedrag` double NOT NULL,
      `info` tinytext NOT NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=942 ;

    --
    -- Gegevens worden uitgevoerd voor tabel `rekeningstelsel`
    --

    INSERT INTO `rekeningstelsel` VALUES (1, '1. ', 'Eigen vermogen, voorzieningen voor risico’s en kosten en schulden op meer dan één jaar', '', '', '', 0, '');
    INSERT INTO `rekeningstelsel` VALUES (2, '10.', 'Kapitaal', '', 'I.', 'P', 0, '');
    INSERT INTO `rekeningstelsel` VALUES (3, '100', 'Geplaatst kapitaal', '', 'I.A.', 'P', 0, '');
    INSERT INTO `rekeningstelsel` VALUES (4, '101', 'Niet-opgevraagd kapitaal (-)', '', 'I.B.', 'P', 0, '');
    INSERT INTO `rekeningstelsel` VALUES (5, '102', 'Afgeschreven kapitaal', '', 'I.A.', 'P', 0, '');
    INSERT INTO `rekeningstelsel` VALUES (6, '109', 'Rekening van de uitbater', '', 'I.A.', 'P', 0, '');
    INSERT INTO `rekeningstelsel` VALUES (7, '11.', 'Uitgiftepremies', '', 'II.', 'P', 0, '');
    INSERT INTO `rekeningstelsel` VALUES (8, '12.', 'Herwaarderingsmeerwaarden', '', 'III.', 'P', 0, '');
    INSERT INTO `rekeningstelsel` VALUES (9, '120', 'Herwaarderingsmeerwaarden op immateriële vaste activa', '', '', '', 0, '');  ....


    Voor de volledige code : klik hier    (Code te groot voor tekstvak)

    24-08-2007 om 00:00 geschreven door de makers


    » Reageer (0)

    >

    Blog tegen de regels? Meld het ons!
    Gratis blog op http://blog.seniorennet.be - SeniorenNet Blogs, eenvoudig, gratis en snel jouw eigen blog!