Search in sources :

Example 21 with TextField

use of com.codename1.ui.TextField in project CodenameOne by codenameone.

the class ResetableTextWatcher method startEditing.

/**
 * Start editing the given text-area
 * This method is executed on the UI thread, so UI manipulation is safe here.
 * @param activity Current running activity
 * @param textArea The TextAreaData instance that wraps the CN1 TextArea that our internal EditText needs to overlap.  We use
 *                 a TextAreaData so that the text area properties can be accessed off the EDT safely.
 * @param codenameOneInputType One of the input type constants in com.codename1.ui.TextArea
 * @param initialText The text that appears in the Codename One text are before the call to startEditing
 * @param isEditedFieldSwitch if true, then special case for async edit mode - the native editing is already active, no need to show
 *                            native field, just change the connected field
 */
private synchronized void startEditing(Activity activity, TextAreaData textArea, String initialText, int codenameOneInputType, final boolean isEditedFieldSwitch) {
    int txty = lastTextAreaY = textArea.getAbsoluteY() + textArea.getScrollY();
    int txtx = lastTextAreaX = textArea.getAbsoluteX() + textArea.getScrollX();
    lastTextAreaWidth = textArea.getWidth();
    lastTextAreaHeight = textArea.getHeight();
    int paddingTop = 0;
    int paddingLeft = textArea.paddingLeft;
    int paddingRight = textArea.paddingRight;
    int paddingBottom = textArea.paddingBottom;
    if (textArea.isTextField) {
        switch(textArea.getVerticalAlignment()) {
            case Component.BOTTOM:
                paddingTop = textArea.getHeight() - textArea.paddingBottom - textArea.fontHeight;
                break;
            case Component.CENTER:
                paddingTop = textArea.getHeight() / 2 - textArea.fontHeight / 2;
                break;
            default:
                paddingTop = textArea.paddingTop;
                break;
        }
    } else {
        paddingTop = textArea.paddingTop;
    }
    int id = activity.getResources().getIdentifier("cn1Style", "attr", activity.getApplicationInfo().packageName);
    if (!isEditedFieldSwitch) {
        mEditText = new EditView(activity, textArea.textArea, this, id);
    } else {
        mEditText.switchToTextArea(textArea.textArea);
    }
    if (textArea.getClientProperty("blockCopyPaste") != null || Display.getInstance().getProperty("blockCopyPaste", "false").equals("true")) {
        // The code below is taken from this stackoverflow answer: http://stackoverflow.com/a/22756538/756809
        if (android.os.Build.VERSION.SDK_INT < 11) {
            mEditText.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {

                @Override
                public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
                    menu.clear();
                }
            });
        } else {
            mEditText.setCustomSelectionActionModeCallback(new ActionMode.Callback() {

                public boolean onPrepareActionMode(ActionMode mode, Menu menu) {
                    return false;
                }

                public void onDestroyActionMode(ActionMode mode) {
                }

                public boolean onCreateActionMode(ActionMode mode, Menu menu) {
                    return false;
                }

                public boolean onActionItemClicked(ActionMode mode, MenuItem item) {
                    return false;
                }
            });
        }
    } else if (isEditedFieldSwitch) {
        // reset copy-paste protection
        if (android.os.Build.VERSION.SDK_INT < 11) {
            mEditText.setOnCreateContextMenuListener(null);
        } else {
            mEditText.setCustomSelectionActionModeCallback(null);
        }
    }
    if (!isEditedFieldSwitch) {
        mEditText.addTextChangedListener(mEditText.mTextWatcher);
    }
    mEditText.setBackgroundDrawable(null);
    mEditText.setFocusableInTouchMode(true);
    mEditLayoutParams = new FrameLayout.LayoutParams(0, 0);
    // Set the appropriate gravity so that the left and top margins will be
    // taken into account
    mEditLayoutParams.gravity = Gravity.LEFT | Gravity.TOP;
    mEditLayoutParams.setMargins(txtx, txty, 0, 0);
    mEditLayoutParams.width = textArea.getWidth();
    mEditLayoutParams.height = textArea.getHeight();
    mEditText.setLayoutParams(mEditLayoutParams);
    if (textArea.isRTL()) {
        mEditText.setGravity(Gravity.RIGHT | Gravity.TOP);
    } else {
        mEditText.setGravity(Gravity.LEFT | Gravity.TOP);
    }
    mEditText.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
    Component nextDown = textArea.nextDown;
    boolean imeOptionTaken = true;
    int ime = EditorInfo.IME_FLAG_NO_EXTRACT_UI;
    if (textArea.isSingleLineTextArea()) {
        if (textArea.getClientProperty("searchField") != null) {
            mEditText.setImeOptions(ime | EditorInfo.IME_ACTION_SEARCH);
        } else {
            if (textArea.getClientProperty("sendButton") != null) {
                mEditText.setImeOptions(ime | EditorInfo.IME_ACTION_SEND);
            } else {
                if (textArea.getClientProperty("goButton") != null) {
                    mEditText.setImeOptions(ime | EditorInfo.IME_ACTION_GO);
                } else {
                    if (textArea.isTextField && textArea.getDoneListener() != null) {
                        mEditText.setImeOptions(ime | EditorInfo.IME_ACTION_DONE);
                    } else if (nextDown != null && nextDown instanceof TextArea && ((TextArea) nextDown).isEditable() && ((TextArea) nextDown).isEnabled()) {
                        mEditText.setImeOptions(ime | EditorInfo.IME_ACTION_NEXT);
                    } else {
                        mEditText.setImeOptions(ime | EditorInfo.IME_ACTION_DONE);
                        imeOptionTaken = false;
                    }
                }
            }
        }
    }
    mEditText.setSingleLine(textArea.isSingleLineTextArea());
    mEditText.setAdapter((ArrayAdapter<String>) null);
    mEditText.setText(initialText);
    if (!textArea.isSingleLineTextArea() && textArea.textArea.isGrowByContent() && textArea.textArea.getGrowLimit() > -1) {
        defaultMaxLines = mEditText.getMaxLines();
        mEditText.setMaxLines(textArea.textArea.getGrowLimit());
    }
    if (textArea.nativeHintBool && textArea.getHint() != null) {
        mEditText.setHint(textArea.getHint());
    }
    if (!isEditedFieldSwitch) {
        addView(mEditText, mEditLayoutParams);
    }
    invalidate();
    setVisibility(VISIBLE);
    bringToFront();
    mEditText.requestFocus();
    Object nativeFont = textArea.nativeFont;
    if (nativeFont == null) {
        nativeFont = impl.getDefaultFont();
    }
    Paint p = (Paint) ((AndroidImplementation.NativeFont) nativeFont).font;
    mEditText.setTypeface(p.getTypeface());
    mEditText.setTextScaleX(p.getTextScaleX());
    mEditText.setTextSize(TypedValue.COMPLEX_UNIT_PX, p.getTextSize());
    int fgColor = textArea.fgColor;
    mEditText.setTextColor(Color.rgb(fgColor >> 16, (fgColor & 0x00ff00) >> 8, (fgColor & 0x0000ff)));
    boolean password = false;
    if ((codenameOneInputType & TextArea.PASSWORD) == TextArea.PASSWORD) {
        codenameOneInputType = codenameOneInputType ^ TextArea.PASSWORD;
        password = true;
    }
    if (textArea.isSingleLineTextArea()) {
        mEditText.setInputType(getAndroidInputType(codenameOneInputType));
        // if not ime was explicity requested and this is a single line textfield of type ANY add the emoji keyboard.
        if (!imeOptionTaken && codenameOneInputType == TextArea.ANY) {
            mEditText.setInputType(getAndroidInputType(codenameOneInputType) | InputType.TYPE_TEXT_VARIATION_SHORT_MESSAGE);
        }
        if (Display.getInstance().getProperty("andAddComma", "false").equals("true") && (codenameOneInputType & TextArea.DECIMAL) == TextArea.DECIMAL) {
            defaultKeyListener = mEditText.getKeyListener();
            mEditText.setKeyListener(DigitsKeyListener.getInstance("0123456789.,"));
        }
    }
    if (password) {
        int type = mInputTypeMap.get(codenameOneInputType, InputType.TYPE_CLASS_TEXT);
        if ((type & InputType.TYPE_TEXT_FLAG_CAP_SENTENCES) == InputType.TYPE_TEXT_FLAG_CAP_SENTENCES) {
            type = type ^ InputType.TYPE_TEXT_FLAG_CAP_SENTENCES;
        }
        // turn off suggestions for passwords
        mEditText.setInputType(type | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);
        mEditText.setTransformationMethod(new MyPasswordTransformationMethod());
    }
    int maxLength = textArea.maxSize;
    InputFilter[] FilterArray = new InputFilter[1];
    FilterArray[0] = new InputFilter.LengthFilter(maxLength);
    mEditText.setFilters(FilterArray);
    mEditText.setSelection(mEditText.getText().length());
    showVirtualKeyboard(true);
    if (Boolean.FALSE.equals(textArea.getClientProperty("android.cursorVisible"))) {
        // This provides an imperfect workaround for this issue:
        // https://github.com/codenameone/CodenameOne/issues/2317
        // Blinking cursor causes text to disappear on some versions of android
        // Can't seem to find how to detect whether device is affected, so
        // just providing a client property to disable the blinking cursor
        // on a particular text field.
        mEditText.setCursorVisible(false);
    }
/*
        // Leaving this hack here for posterity.  It seems that this manually
        // blinking cursor causes the paste menu to disappear
        // https://github.com/codenameone/CodenameOne/issues/2147
        // Removing the hack below, fixes this issue.  And in the test device
        // I'm using the blinking of text doesn't seem to occur, so perhaps
        // it was fixed via other means.  Test device:
        // Name: Samsung Galaxy S3 (T-Mobile)
        //    OS: 4.3
        //    Manufacturer: Samsung
        //    Model: 4.3
        //    Chipset: armeabi-v7a 1512MHz
        //    Memory: 16000000000
        //    Heap: 256000000
        //    Display: 720 x 1280
        //
        // UPDATE Feb. 13, 2018:
        // This issue seems to be still present in some devices, but it isn't clear even
        // how to detect it.
        // Issue reported and reproduced here https://github.com/codenameone/CodenameOne/issues/2317
        // Issue has been observed in a Virtual Box installation with 5.1.1, but
        // cannot be reproduced in a Nexus 5 running 5.1.1.
        // 
        if (Build.VERSION.SDK_INT < 21) {
            // HACK!!!  On Android 4.4, it seems that the natural blinking cursor
            // causes text to disappear when it blinks.  Manually blinking the
            // cursor seems to work around this issue, so that's what we do here.
            // This issue is described here: http://stackoverflow.com/questions/41305052/textfields-content-disappears-during-typing?noredirect=1#comment69977316_41305052
            mEditText.setCursorVisible(false);
            final boolean[] cursorVisible = new boolean[]{false};
            if (cursorTimer != null) {
                cursorTimer.cancel();
            }
            cursorTimer = new Timer();
            cursorTimerTask = new TimerTask() {
                public void run() {
                    AndroidNativeUtil.getActivity().runOnUiThread(new Runnable() {
                        public void run() {
                            EditView v = mEditText;
                            if (v != null) {
                                cursorVisible[0] = !cursorVisible[0];
                                v.setCursorVisible(cursorVisible[0]);
                            }
                        }
                    });

                }
            };
            cursorTimer.schedule(cursorTimerTask, 100, 500);
        }
        */
}
Also used : InputFilter(android.text.InputFilter) TextArea(com.codename1.ui.TextArea) ContextMenu(android.view.ContextMenu) MenuItem(android.view.MenuItem) Paint(android.graphics.Paint) View(android.view.View) AutoCompleteTextView(android.widget.AutoCompleteTextView) Paint(android.graphics.Paint) ActionMode(android.view.ActionMode) FrameLayout(android.widget.FrameLayout) ContextMenuInfo(android.view.ContextMenu.ContextMenuInfo) ContextMenu(android.view.ContextMenu) Menu(android.view.Menu) Component(com.codename1.ui.Component)

Example 22 with TextField

use of com.codename1.ui.TextField in project CodenameOne by codenameone.

the class ResetableTextWatcher method endEditing.

/**
 * Finish the in-place editing of the given text area, release the edit lock, and allow the synchronous call
 * to 'edit' to return.
 */
private synchronized void endEditing(int reason, boolean forceVKBOpen, boolean forceVKBClose, int actionCode) {
    // }
    if (!mIsEditing || mEditText == null) {
        return;
    }
    // SJH: Setting visibility GONE causes a size change event to be fired even when the
    // input mode is adjustPan.  This causes problems and glitches with the layout because we
    // have to guess if a resize even is accurate or not.
    // setVisibility(GONE);
    mLastEndEditReason = reason;
    // If the IME action is set to NEXT, do not hide the virtual keyboard
    boolean isNextActionFlagSet = ((mEditText.getImeOptions() & 0xf) == EditorInfo.IME_ACTION_NEXT);
    boolean leaveKeyboardShowing = impl.isAsyncEditMode() || (reason == REASON_IME_ACTION) && isNextActionFlagSet || forceVKBOpen;
    if (forceVKBClose) {
        leaveKeyboardShowing = false;
    }
    if (!leaveKeyboardShowing || actionCode == EditorInfo.IME_ACTION_DONE || actionCode == EditorInfo.IME_ACTION_SEARCH || actionCode == EditorInfo.IME_ACTION_SEND || actionCode == EditorInfo.IME_ACTION_GO) {
        showVirtualKeyboard(false);
    }
    // Get rid of flags
    int imo = mEditText.getImeOptions() & 0xf;
    if (reason == REASON_IME_ACTION && mEditText.mTextArea instanceof TextField && ((TextField) mEditText.mTextArea).getDoneListener() != null && (actionCode == EditorInfo.IME_ACTION_DONE) || actionCode == EditorInfo.IME_ACTION_SEARCH || actionCode == EditorInfo.IME_ACTION_SEND || actionCode == EditorInfo.IME_ACTION_GO) {
        ((TextField) mEditText.mTextArea).fireDoneEvent();
    }
    // Call this in onComplete instead
    // mIsEditing = false;
    mLastEditText = mEditText;
    removeView(mEditText);
    Component editingComponent = mEditText.mTextArea;
    mEditText.removeTextChangedListener(mEditText.mTextWatcher);
    mEditText = null;
    if (impl.isAsyncEditMode()) {
        Runnable onComplete = (Runnable) editingComponent.getClientProperty("android.onAsyncEditingComplete");
        editingComponent.putClientProperty("android.onAsyncEditingComplete", null);
        if (onComplete != null) {
            Display.getInstance().callSerially(onComplete);
        }
    }
    waitingForSynchronousEditingCompletion = false;
}
Also used : TextField(com.codename1.ui.TextField) Component(com.codename1.ui.Component) Paint(android.graphics.Paint)

Example 23 with TextField

use of com.codename1.ui.TextField in project CodenameOne by codenameone.

the class AddThemeEntry method initComponents.

/**
 * This method is called from within the constructor to
 * initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    buttonGroup1 = new javax.swing.ButtonGroup();
    jLabel1 = new javax.swing.JLabel();
    componentName = new javax.swing.JComboBox();
    previewPane = new javax.swing.JPanel();
    jLabel6 = new javax.swing.JLabel();
    addTabs = new javax.swing.JTabbedPane();
    jPanel3 = new javax.swing.JPanel();
    jLabel23 = new javax.swing.JLabel();
    imagesCombo = new javax.swing.JComboBox();
    addNewImage = new javax.swing.JButton();
    jLabel16 = new javax.swing.JLabel();
    backgroundType = new javax.swing.JComboBox();
    jLabel18 = new javax.swing.JLabel();
    gradientStartColor = new javax.swing.JTextField();
    changeGradientStartColorButton = new javax.swing.JButton();
    gradientEndColor = new javax.swing.JTextField();
    changeGradientEndColorButton = new javax.swing.JButton();
    jLabel19 = new javax.swing.JLabel();
    gradientX = new javax.swing.JSpinner();
    gradientY = new javax.swing.JSpinner();
    gradientSize = new javax.swing.JSpinner();
    deriveBackground = new javax.swing.JCheckBox();
    deriveHelp = new javax.swing.JButton();
    backgroundHelp = new javax.swing.JButton();
    jLabel2 = new javax.swing.JLabel();
    jLabel14 = new javax.swing.JLabel();
    jPanel1 = new javax.swing.JPanel();
    colorValueFG = new javax.swing.JTextField();
    changeColorButtonFG = new javax.swing.JButton();
    deriveForegroundColor = new javax.swing.JCheckBox();
    jLabel3 = new javax.swing.JLabel();
    colorValueBG = new javax.swing.JTextField();
    changeColorButtonBG = new javax.swing.JButton();
    jLabel4 = new javax.swing.JLabel();
    deriveBackgroundColor = new javax.swing.JCheckBox();
    deriveTransparency = new javax.swing.JCheckBox();
    jLabel5 = new javax.swing.JLabel();
    transparencyValue = new javax.swing.JSpinner();
    deriveHelp1 = new javax.swing.JButton();
    colorHelp = new javax.swing.JButton();
    jLabel15 = new javax.swing.JLabel();
    jLabel21 = new javax.swing.JLabel();
    jPanel2 = new javax.swing.JPanel();
    jLabel20 = new javax.swing.JLabel();
    alignmentCombo = new javax.swing.JComboBox();
    deriveAlignment = new javax.swing.JCheckBox();
    deriveHelp2 = new javax.swing.JButton();
    alignHelp = new javax.swing.JButton();
    jPanel5 = new javax.swing.JPanel();
    jLabel8 = new javax.swing.JLabel();
    paddingLeft = new javax.swing.JSpinner();
    jLabel9 = new javax.swing.JLabel();
    paddingRight = new javax.swing.JSpinner();
    jLabel10 = new javax.swing.JLabel();
    paddingTop = new javax.swing.JSpinner();
    jLabel11 = new javax.swing.JLabel();
    paddingBottom = new javax.swing.JSpinner();
    derivePadding = new javax.swing.JCheckBox();
    deriveHelp3 = new javax.swing.JButton();
    paddingHelp = new javax.swing.JButton();
    paddingLeftUnit = new javax.swing.JComboBox();
    paddingRightUnit = new javax.swing.JComboBox();
    paddingTopUnit = new javax.swing.JComboBox();
    paddingBottomUnit = new javax.swing.JComboBox();
    jPanel6 = new javax.swing.JPanel();
    jLabel17 = new javax.swing.JLabel();
    marginLeft = new javax.swing.JSpinner();
    jLabel24 = new javax.swing.JLabel();
    marginRight = new javax.swing.JSpinner();
    jLabel25 = new javax.swing.JLabel();
    marginTop = new javax.swing.JSpinner();
    jLabel26 = new javax.swing.JLabel();
    marginBottom = new javax.swing.JSpinner();
    deriveMargin = new javax.swing.JCheckBox();
    deriveHelp4 = new javax.swing.JButton();
    marginHelp = new javax.swing.JButton();
    marginLeftUnit = new javax.swing.JComboBox();
    marginRightUnit = new javax.swing.JComboBox();
    marginTopUnit = new javax.swing.JComboBox();
    marginBottomUnit = new javax.swing.JComboBox();
    jPanel8 = new javax.swing.JPanel();
    borderLabel = new com.codename1.ui.resource.util.CodenameOneComponentWrapper(new com.codename1.ui.Label("Border"));
    customizeBorder = new javax.swing.JButton();
    deriveBorder = new javax.swing.JCheckBox();
    imageBorderWizard = new javax.swing.JButton();
    jScrollPane1 = new javax.swing.JScrollPane();
    jTextArea1 = new javax.swing.JTextArea();
    deriveHelp5 = new javax.swing.JButton();
    borderHelp = new javax.swing.JButton();
    jPanel10 = new javax.swing.JPanel();
    baseStyle = new javax.swing.JComboBox();
    baseStyleType = new javax.swing.JComboBox();
    defineAttribute = new javax.swing.JCheckBox();
    deriveHelp6 = new javax.swing.JButton();
    jLabel22 = new javax.swing.JLabel();
    jPanel7 = new javax.swing.JPanel();
    bitmapFont = new javax.swing.JRadioButton();
    systemFont = new javax.swing.JRadioButton();
    bitmapFontValue = new javax.swing.JComboBox();
    addNewBitmapFont = new javax.swing.JButton();
    fontFace = new javax.swing.JComboBox();
    fontStyle = new javax.swing.JComboBox();
    fontSize = new javax.swing.JComboBox();
    deriveFont = new javax.swing.JCheckBox();
    textDecorationCombo = new javax.swing.JComboBox();
    deriveTextDecoration = new javax.swing.JCheckBox();
    jLabel7 = new javax.swing.JLabel();
    deriveHelp7 = new javax.swing.JButton();
    fontHelp = new javax.swing.JButton();
    jLabel12 = new javax.swing.JLabel();
    trueTypeFont = new javax.swing.JComboBox();
    jLabel13 = new javax.swing.JLabel();
    trueTypeFontSizeOption = new javax.swing.JComboBox();
    trueTypeFontSizeValue = new javax.swing.JSpinner();
    jScrollPane2 = new javax.swing.JScrollPane();
    help = new javax.swing.JTextPane();
    styleType = new javax.swing.JLabel();
    styleHelp = new javax.swing.JButton();
    videoTutorial = new javax.swing.JButton();
    FormListener formListener = new FormListener();
    // NOI18N
    setName("Form");
    jLabel1.setText("Component");
    // NOI18N
    jLabel1.setName("jLabel1");
    componentName.setEditable(true);
    // NOI18N
    componentName.setName("componentName");
    componentName.setPrototypeDisplayValue("XXXXXXXXXXXXXX");
    componentName.addActionListener(formListener);
    // NOI18N
    previewPane.setName("previewPane");
    previewPane.setLayout(new java.awt.BorderLayout());
    jLabel6.setText("Preview");
    // NOI18N
    jLabel6.setName("jLabel6");
    // NOI18N
    addTabs.setName("addTabs");
    // NOI18N
    jPanel3.setName("jPanel3");
    jPanel3.setOpaque(false);
    jLabel23.setText("Image");
    // NOI18N
    jLabel23.setName("jLabel23");
    imagesCombo.setEnabled(false);
    // NOI18N
    imagesCombo.setName("imagesCombo");
    imagesCombo.addActionListener(formListener);
    addNewImage.setText("...");
    addNewImage.setEnabled(false);
    // NOI18N
    addNewImage.setName("addNewImage");
    addNewImage.addActionListener(formListener);
    jLabel16.setText("Type");
    // NOI18N
    jLabel16.setName("jLabel16");
    backgroundType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "IMAGE_SCALED", "IMAGE_SCALED_FILL", "IMAGE_SCALED_FIT", "IMAGE_TILE_BOTH", "IMAGE_TILE_VERTICAL_ALIGN_LEFT", "IMAGE_TILE_VERTICAL_ALIGN_CENTER", "IMAGE_TILE_VERTICAL_ALIGN_RIGHT", "IMAGE_TILE_HORIZONTAL_ALIGN_TOP", "IMAGE_TILE_HORIZONTAL_ALIGN_CENTER", "IMAGE_TILE_HORIZONTAL_ALIGN_BOTTOM", "IMAGE_ALIGNED_TOP", "IMAGE_ALIGNED_BOTTOM", "IMAGE_ALIGNED_LEFT", "IMAGE_ALIGNED_RIGHT", "IMAGE_ALIGNED_TOP_LEFT", "IMAGE_ALIGNED_TOP_RIGHT", "IMAGE_ALIGNED_BOTTOM_LEFT", "IMAGE_ALIGNED_BOTTOM_RIGHT", "IMAGE_ALIGNED_CENTER", "GRADIENT_LINEAR_HORIZONTAL", "GRADIENT_LINEAR_VERTICAL", "GRADIENT_RADIAL", "NONE" }));
    backgroundType.setEnabled(false);
    // NOI18N
    backgroundType.setName("backgroundType");
    backgroundType.addActionListener(formListener);
    jLabel18.setText("Gradient");
    // NOI18N
    jLabel18.setName("jLabel18");
    gradientStartColor.setText("000000");
    gradientStartColor.setEnabled(false);
    // NOI18N
    gradientStartColor.setName("gradientStartColor");
    changeGradientStartColorButton.setText("...");
    changeGradientStartColorButton.setEnabled(false);
    // NOI18N
    changeGradientStartColorButton.setName("changeGradientStartColorButton");
    changeGradientStartColorButton.addActionListener(formListener);
    gradientEndColor.setText("000000");
    gradientEndColor.setEnabled(false);
    // NOI18N
    gradientEndColor.setName("gradientEndColor");
    changeGradientEndColorButton.setText("...");
    changeGradientEndColorButton.setEnabled(false);
    // NOI18N
    changeGradientEndColorButton.setName("changeGradientEndColorButton");
    changeGradientEndColorButton.addActionListener(formListener);
    jLabel19.setText("Gradient X/Y");
    // NOI18N
    jLabel19.setName("jLabel19");
    gradientX.setToolTipText("Gradient Relative X");
    gradientX.setEnabled(false);
    // NOI18N
    gradientX.setName("gradientX");
    gradientX.addChangeListener(formListener);
    gradientY.setToolTipText("Gradient Relative Y");
    gradientY.setEnabled(false);
    // NOI18N
    gradientY.setName("gradientY");
    gradientY.addChangeListener(formListener);
    gradientSize.setToolTipText("Gradient Relaitve Size");
    gradientSize.setEnabled(false);
    // NOI18N
    gradientSize.setName("gradientSize");
    gradientSize.addChangeListener(formListener);
    deriveBackground.setSelected(true);
    deriveBackground.setText("Derive");
    // NOI18N
    deriveBackground.setName("deriveBackground");
    deriveBackground.addActionListener(formListener);
    deriveHelp.setText("Derive Help");
    // NOI18N
    deriveHelp.setName("deriveHelp");
    deriveHelp.addActionListener(formListener);
    backgroundHelp.setText("Background Help");
    // NOI18N
    backgroundHelp.setName("backgroundHelp");
    backgroundHelp.addActionListener(formListener);
    jLabel2.setText("Gradient Size");
    // NOI18N
    jLabel2.setName("jLabel2");
    jLabel14.setText("<html><body><b>Notice:</b> If a border is defined the background will have no effect! Set the border<br>property to Empty to override the border of a base style");
    // NOI18N
    jLabel14.setName("jLabel14");
    org.jdesktop.layout.GroupLayout jPanel3Layout = new org.jdesktop.layout.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel3Layout.createSequentialGroup().addContainerGap().add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jPanel3Layout.createSequentialGroup().add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel16).add(jLabel23).add(jLabel18).add(jLabel19).add(jLabel2)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(gradientSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jPanel3Layout.createSequentialGroup().add(imagesCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 325, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(addNewImage)).add(backgroundType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 325, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jPanel3Layout.createSequentialGroup().add(gradientStartColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 54, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(changeGradientStartColorButton).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(gradientEndColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 52, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(changeGradientEndColorButton)).add(jPanel3Layout.createSequentialGroup().add(gradientX, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(gradientY, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))).add(deriveBackground)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 383, Short.MAX_VALUE).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(org.jdesktop.layout.GroupLayout.TRAILING, backgroundHelp).add(org.jdesktop.layout.GroupLayout.TRAILING, deriveHelp)).addContainerGap()));
    jPanel3Layout.linkSize(new java.awt.Component[] { gradientEndColor, gradientSize, gradientStartColor, gradientX, gradientY }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
    jPanel3Layout.linkSize(new java.awt.Component[] { backgroundType, imagesCombo }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
    jPanel3Layout.linkSize(new java.awt.Component[] { backgroundHelp, deriveHelp }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
    jPanel3Layout.setVerticalGroup(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel3Layout.createSequentialGroup().add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel3Layout.createSequentialGroup().add(4, 4, 4).add(deriveHelp).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(backgroundHelp)).add(jPanel3Layout.createSequentialGroup().add(15, 15, 15).add(jLabel14, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(18, 18, 18).add(deriveBackground).addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel16).add(backgroundType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel23).add(imagesCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(addNewImage)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(jLabel18).add(gradientStartColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(changeGradientStartColorButton).add(changeGradientEndColorButton).add(gradientEndColor, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(jLabel19).add(gradientX, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(gradientY, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel3Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(jLabel2).add(gradientSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))).addContainerGap(199, Short.MAX_VALUE)));
    addTabs.addTab("Background", jPanel3);
    // NOI18N
    jPanel1.setName("jPanel1");
    jPanel1.setOpaque(false);
    colorValueFG.setText("000000");
    colorValueFG.setEnabled(false);
    // NOI18N
    colorValueFG.setName("colorValueFG");
    changeColorButtonFG.setText("...");
    changeColorButtonFG.setEnabled(false);
    // NOI18N
    changeColorButtonFG.setName("changeColorButtonFG");
    changeColorButtonFG.addActionListener(formListener);
    deriveForegroundColor.setSelected(true);
    deriveForegroundColor.setText("Derive Foreground");
    // NOI18N
    deriveForegroundColor.setName("deriveForegroundColor");
    deriveForegroundColor.addActionListener(formListener);
    jLabel3.setText("Background");
    // NOI18N
    jLabel3.setName("jLabel3");
    colorValueBG.setText("000000");
    colorValueBG.setEnabled(false);
    // NOI18N
    colorValueBG.setName("colorValueBG");
    changeColorButtonBG.setText("...");
    changeColorButtonBG.setEnabled(false);
    // NOI18N
    changeColorButtonBG.setName("changeColorButtonBG");
    changeColorButtonBG.addActionListener(formListener);
    jLabel4.setText("Foreground");
    // NOI18N
    jLabel4.setName("jLabel4");
    deriveBackgroundColor.setSelected(true);
    deriveBackgroundColor.setText("Derive Background");
    // NOI18N
    deriveBackgroundColor.setName("deriveBackgroundColor");
    deriveBackgroundColor.addActionListener(formListener);
    deriveTransparency.setSelected(true);
    deriveTransparency.setText("Derive Transparency");
    // NOI18N
    deriveTransparency.setName("deriveTransparency");
    deriveTransparency.addActionListener(formListener);
    jLabel5.setText("Transparency");
    // NOI18N
    jLabel5.setName("jLabel5");
    transparencyValue.setEnabled(false);
    // NOI18N
    transparencyValue.setName("transparencyValue");
    transparencyValue.addChangeListener(formListener);
    deriveHelp1.setText("Derive Help");
    // NOI18N
    deriveHelp1.setName("deriveHelp1");
    deriveHelp1.addActionListener(formListener);
    colorHelp.setText("Color Help");
    // NOI18N
    colorHelp.setName("colorHelp");
    colorHelp.addActionListener(formListener);
    jLabel15.setText("<html><body><b>Notice:</b> If a border is defined the background will have no effect! Set the border<br>property to Empty to override the border of a base style");
    // NOI18N
    jLabel15.setName("jLabel15");
    jLabel21.setText("<html><body><b>Notice:</b> some types of backgrounds might override the background color.<br/>Transparency should be 255 to achieve full opacity");
    // NOI18N
    jLabel21.setName("jLabel21");
    org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel1Layout.createSequentialGroup().addContainerGap().add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel1Layout.createSequentialGroup().addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 9, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel4).add(jLabel3).add(jLabel5)).add(12, 12, 12).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel1Layout.createSequentialGroup().add(colorValueFG, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(changeColorButtonFG)).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false).add(org.jdesktop.layout.GroupLayout.LEADING, transparencyValue).add(org.jdesktop.layout.GroupLayout.LEADING, jPanel1Layout.createSequentialGroup().add(colorValueBG, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 66, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(changeColorButtonBG)))).add(0, 735, Short.MAX_VALUE)).add(jPanel1Layout.createSequentialGroup().add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(deriveForegroundColor).add(deriveBackgroundColor).add(deriveTransparency).add(jLabel21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 464, Short.MAX_VALUE).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(org.jdesktop.layout.GroupLayout.TRAILING, deriveHelp1).add(org.jdesktop.layout.GroupLayout.TRAILING, colorHelp)))).addContainerGap()));
    jPanel1Layout.linkSize(new java.awt.Component[] { colorHelp, deriveHelp1 }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel1Layout.createSequentialGroup().add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel1Layout.createSequentialGroup().addContainerGap().add(jLabel15, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jLabel21, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(20, 20, 20).add(deriveForegroundColor).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(colorValueFG, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(changeColorButtonFG).add(jLabel4)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(deriveBackgroundColor).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(colorValueBG, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(changeColorButtonBG).add(jLabel3)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(deriveTransparency).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(jLabel5).add(transparencyValue, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))).add(jPanel1Layout.createSequentialGroup().add(deriveHelp1).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(colorHelp))).addContainerGap(181, Short.MAX_VALUE)));
    addTabs.addTab("Color", jPanel1);
    // NOI18N
    jPanel2.setName("jPanel2");
    jPanel2.setOpaque(false);
    jLabel20.setText("Alignment");
    // NOI18N
    jLabel20.setName("jLabel20");
    alignmentCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Left", "Right", "Center" }));
    alignmentCombo.setEnabled(false);
    // NOI18N
    alignmentCombo.setName("alignmentCombo");
    alignmentCombo.addActionListener(formListener);
    deriveAlignment.setSelected(true);
    deriveAlignment.setText("Derive");
    // NOI18N
    deriveAlignment.setName("deriveAlignment");
    deriveAlignment.addActionListener(formListener);
    deriveHelp2.setText("Derive Help");
    // NOI18N
    deriveHelp2.setName("deriveHelp2");
    deriveHelp2.addActionListener(formListener);
    alignHelp.setText("Alignment Help");
    // NOI18N
    alignHelp.setName("alignHelp");
    alignHelp.addActionListener(formListener);
    org.jdesktop.layout.GroupLayout jPanel2Layout = new org.jdesktop.layout.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel2Layout.createSequentialGroup().addContainerGap().add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel2Layout.createSequentialGroup().add(deriveAlignment).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 779, Short.MAX_VALUE).add(deriveHelp2)).add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel2Layout.createSequentialGroup().add(jLabel20).add(9, 9, 9).add(alignmentCombo, 0, 774, Short.MAX_VALUE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(alignHelp))).addContainerGap()));
    jPanel2Layout.linkSize(new java.awt.Component[] { alignHelp, deriveHelp2 }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
    jPanel2Layout.setVerticalGroup(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel2Layout.createSequentialGroup().addContainerGap().add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(deriveAlignment).add(deriveHelp2)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel2Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel20).add(alignmentCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(alignHelp)).addContainerGap(394, Short.MAX_VALUE)));
    addTabs.addTab("Alignment", jPanel2);
    // NOI18N
    jPanel5.setName("jPanel5");
    jPanel5.setOpaque(false);
    jLabel8.setText("Left");
    // NOI18N
    jLabel8.setName("jLabel8");
    paddingLeft.setEnabled(false);
    // NOI18N
    paddingLeft.setName("paddingLeft");
    paddingLeft.addChangeListener(formListener);
    jLabel9.setText("Right");
    // NOI18N
    jLabel9.setName("jLabel9");
    paddingRight.setEnabled(false);
    // NOI18N
    paddingRight.setName("paddingRight");
    paddingRight.addChangeListener(formListener);
    jLabel10.setText("Top");
    // NOI18N
    jLabel10.setName("jLabel10");
    paddingTop.setEnabled(false);
    // NOI18N
    paddingTop.setName("paddingTop");
    paddingTop.addChangeListener(formListener);
    jLabel11.setText("Bottom");
    // NOI18N
    jLabel11.setName("jLabel11");
    paddingBottom.setEnabled(false);
    // NOI18N
    paddingBottom.setName("paddingBottom");
    paddingBottom.addChangeListener(formListener);
    derivePadding.setSelected(true);
    derivePadding.setText("Derive");
    // NOI18N
    derivePadding.setName("derivePadding");
    derivePadding.addActionListener(formListener);
    deriveHelp3.setText("Derive Help");
    // NOI18N
    deriveHelp3.setName("deriveHelp3");
    deriveHelp3.addActionListener(formListener);
    paddingHelp.setText("Padding Help");
    // NOI18N
    paddingHelp.setName("paddingHelp");
    paddingHelp.addActionListener(formListener);
    paddingLeftUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
    // NOI18N
    paddingLeftUnit.setName("paddingLeftUnit");
    paddingLeftUnit.addActionListener(formListener);
    paddingRightUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
    // NOI18N
    paddingRightUnit.setName("paddingRightUnit");
    paddingRightUnit.addActionListener(formListener);
    paddingTopUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
    // NOI18N
    paddingTopUnit.setName("paddingTopUnit");
    paddingTopUnit.addActionListener(formListener);
    paddingBottomUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
    // NOI18N
    paddingBottomUnit.setName("paddingBottomUnit");
    paddingBottomUnit.addActionListener(formListener);
    org.jdesktop.layout.GroupLayout jPanel5Layout = new org.jdesktop.layout.GroupLayout(jPanel5);
    jPanel5.setLayout(jPanel5Layout);
    jPanel5Layout.setHorizontalGroup(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel5Layout.createSequentialGroup().add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false).add(jPanel5Layout.createSequentialGroup().add(10, 10, 10).add(derivePadding)).add(jPanel5Layout.createSequentialGroup().addContainerGap().add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel8).add(jLabel9).add(jLabel10).add(jLabel11)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false).add(paddingLeft, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE).add(paddingRight).add(paddingTop).add(paddingBottom)).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false).add(jPanel5Layout.createSequentialGroup().add(7, 7, 7).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(org.jdesktop.layout.GroupLayout.TRAILING, paddingRightUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(org.jdesktop.layout.GroupLayout.TRAILING, paddingTopUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(org.jdesktop.layout.GroupLayout.TRAILING, paddingBottomUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))).add(jPanel5Layout.createSequentialGroup().addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(paddingLeftUnit, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 553, Short.MAX_VALUE).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(org.jdesktop.layout.GroupLayout.TRAILING, paddingHelp).add(org.jdesktop.layout.GroupLayout.TRAILING, deriveHelp3)).addContainerGap()));
    jPanel5Layout.linkSize(new java.awt.Component[] { deriveHelp3, paddingHelp }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
    jPanel5Layout.setVerticalGroup(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel5Layout.createSequentialGroup().addContainerGap().add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(derivePadding).add(deriveHelp3)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel8).add(paddingLeft, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(paddingLeftUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(paddingHelp)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel9).add(paddingRight, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(paddingRightUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel10).add(paddingTop, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(paddingTopUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel5Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel11).add(paddingBottom, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(paddingBottomUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addContainerGap(288, Short.MAX_VALUE)));
    jPanel5Layout.linkSize(new java.awt.Component[] { paddingBottom, paddingLeft, paddingRight, paddingTop }, org.jdesktop.layout.GroupLayout.VERTICAL);
    addTabs.addTab("Padding", jPanel5);
    // NOI18N
    jPanel6.setName("jPanel6");
    jPanel6.setOpaque(false);
    jLabel17.setText("Left");
    // NOI18N
    jLabel17.setName("jLabel17");
    marginLeft.setEnabled(false);
    // NOI18N
    marginLeft.setName("marginLeft");
    marginLeft.addChangeListener(formListener);
    jLabel24.setText("Right");
    // NOI18N
    jLabel24.setName("jLabel24");
    marginRight.setEnabled(false);
    // NOI18N
    marginRight.setName("marginRight");
    marginRight.addChangeListener(formListener);
    jLabel25.setText("Top");
    // NOI18N
    jLabel25.setName("jLabel25");
    marginTop.setEnabled(false);
    // NOI18N
    marginTop.setName("marginTop");
    marginTop.addChangeListener(formListener);
    jLabel26.setText("Bottom");
    // NOI18N
    jLabel26.setName("jLabel26");
    marginBottom.setEnabled(false);
    // NOI18N
    marginBottom.setName("marginBottom");
    marginBottom.addChangeListener(formListener);
    deriveMargin.setSelected(true);
    deriveMargin.setText("Derive");
    // NOI18N
    deriveMargin.setName("deriveMargin");
    deriveMargin.addActionListener(formListener);
    deriveHelp4.setText("Derive Help");
    // NOI18N
    deriveHelp4.setName("deriveHelp4");
    deriveHelp4.addActionListener(formListener);
    marginHelp.setText("Margin Help");
    // NOI18N
    marginHelp.setName("marginHelp");
    marginHelp.addActionListener(formListener);
    marginLeftUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
    // NOI18N
    marginLeftUnit.setName("marginLeftUnit");
    marginLeftUnit.addActionListener(formListener);
    marginRightUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
    // NOI18N
    marginRightUnit.setName("marginRightUnit");
    marginRightUnit.addActionListener(formListener);
    marginTopUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
    // NOI18N
    marginTopUnit.setName("marginTopUnit");
    marginTopUnit.addActionListener(formListener);
    marginBottomUnit.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Pixels", "Screen Size Percentage", "Millimeters (approximate)" }));
    // NOI18N
    marginBottomUnit.setName("marginBottomUnit");
    marginBottomUnit.addActionListener(formListener);
    org.jdesktop.layout.GroupLayout jPanel6Layout = new org.jdesktop.layout.GroupLayout(jPanel6);
    jPanel6.setLayout(jPanel6Layout);
    jPanel6Layout.setHorizontalGroup(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel6Layout.createSequentialGroup().addContainerGap().add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel17).add(jLabel24).add(jLabel25).add(jLabel26)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false).add(marginBottom).add(marginTop).add(marginRight).add(marginLeft, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 100, Short.MAX_VALUE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel6Layout.createSequentialGroup().add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(marginBottomUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(marginTopUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(marginRightUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).add(454, 660, Short.MAX_VALUE)).add(jPanel6Layout.createSequentialGroup().add(marginLeftUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).add(marginHelp).addContainerGap()))).add(jPanel6Layout.createSequentialGroup().add(10, 10, 10).add(deriveMargin).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 793, Short.MAX_VALUE).add(deriveHelp4).addContainerGap()));
    jPanel6Layout.linkSize(new java.awt.Component[] { deriveHelp4, marginHelp }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
    jPanel6Layout.linkSize(new java.awt.Component[] { marginBottomUnit, marginLeftUnit, marginRightUnit, marginTopUnit }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
    jPanel6Layout.setVerticalGroup(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel6Layout.createSequentialGroup().addContainerGap().add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(deriveMargin).add(deriveHelp4)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(marginLeftUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(marginLeft, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jLabel17).add(marginHelp)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(jLabel24).add(marginRight, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(marginRightUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(jLabel25).add(marginTop, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(marginTopUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel6Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(jLabel26).add(marginBottom, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(marginBottomUnit, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addContainerGap(316, Short.MAX_VALUE)));
    jPanel6Layout.linkSize(new java.awt.Component[] { marginBottom, marginLeft, marginRight, marginTop }, org.jdesktop.layout.GroupLayout.VERTICAL);
    jPanel6Layout.linkSize(new java.awt.Component[] { marginBottomUnit, marginLeftUnit, marginRightUnit, marginTopUnit }, org.jdesktop.layout.GroupLayout.VERTICAL);
    addTabs.addTab("Margin", jPanel6);
    // NOI18N
    jPanel8.setName("jPanel8");
    jPanel8.setOpaque(false);
    borderLabel.setText("Border");
    // NOI18N
    borderLabel.setName("borderLabel");
    customizeBorder.setText("...");
    customizeBorder.setEnabled(false);
    // NOI18N
    customizeBorder.setName("customizeBorder");
    customizeBorder.addActionListener(formListener);
    deriveBorder.setSelected(true);
    deriveBorder.setText("Derive");
    // NOI18N
    deriveBorder.setName("deriveBorder");
    deriveBorder.addActionListener(formListener);
    imageBorderWizard.setText("Image Border Wizard");
    // NOI18N
    imageBorderWizard.setName("imageBorderWizard");
    imageBorderWizard.addActionListener(formListener);
    jScrollPane1.setBorder(null);
    // NOI18N
    jScrollPane1.setName("jScrollPane1");
    jScrollPane1.setOpaque(false);
    jTextArea1.setColumns(20);
    jTextArea1.setEditable(false);
    jTextArea1.setLineWrap(true);
    jTextArea1.setRows(5);
    jTextArea1.setText("Please notice when using the image border wizard to generate images you are in effect creating additional images in the theme. This means that if you use this wizard you MUST NOT cancel this dialog since the images created by the wizard would remain! You would need to go and delete them (try the \"delete unused images\" option in the menu).\nHaving too many images in the theme can be expensive so try to reuse the same images for multiple component types rather than recreate these images over and over again.");
    jTextArea1.setWrapStyleWord(true);
    jTextArea1.setBorder(null);
    // NOI18N
    jTextArea1.setName("jTextArea1");
    jTextArea1.setOpaque(false);
    jScrollPane1.setViewportView(jTextArea1);
    deriveHelp5.setText("Derive Help");
    // NOI18N
    deriveHelp5.setName("deriveHelp5");
    deriveHelp5.addActionListener(formListener);
    borderHelp.setText("Border Help");
    // NOI18N
    borderHelp.setName("borderHelp");
    borderHelp.addActionListener(formListener);
    org.jdesktop.layout.GroupLayout jPanel8Layout = new org.jdesktop.layout.GroupLayout(jPanel8);
    jPanel8.setLayout(jPanel8Layout);
    jPanel8Layout.setHorizontalGroup(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel8Layout.createSequentialGroup().addContainerGap().add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 939, Short.MAX_VALUE).add(imageBorderWizard).add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel8Layout.createSequentialGroup().add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel8Layout.createSequentialGroup().add(deriveBorder).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 681, Short.MAX_VALUE)).add(jPanel8Layout.createSequentialGroup().add(borderLabel, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 715, Short.MAX_VALUE).add(23, 23, 23))).add(61, 61, 61).add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel8Layout.createSequentialGroup().add(customizeBorder).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(borderHelp)).add(org.jdesktop.layout.GroupLayout.TRAILING, deriveHelp5)))).addContainerGap()));
    jPanel8Layout.linkSize(new java.awt.Component[] { borderHelp, deriveHelp5 }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
    jPanel8Layout.setVerticalGroup(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel8Layout.createSequentialGroup().addContainerGap().add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(deriveBorder).add(deriveHelp5)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel8Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(borderLabel).add(customizeBorder).add(borderHelp)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(imageBorderWizard).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jScrollPane1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 347, Short.MAX_VALUE).addContainerGap()));
    addTabs.addTab("Border", jPanel8);
    // NOI18N
    jPanel10.setName("jPanel10");
    jPanel10.setOpaque(false);
    baseStyle.setEditable(true);
    baseStyle.setEnabled(false);
    // NOI18N
    baseStyle.setName("baseStyle");
    baseStyleType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Unselected", "Selected", "Pressed", "Disabled" }));
    baseStyleType.setEnabled(false);
    // NOI18N
    baseStyleType.setName("baseStyleType");
    defineAttribute.setSelected(true);
    defineAttribute.setText("Override Attribute");
    // NOI18N
    defineAttribute.setName("defineAttribute");
    defineAttribute.addActionListener(formListener);
    deriveHelp6.setText("Derive Help");
    // NOI18N
    deriveHelp6.setName("deriveHelp6");
    deriveHelp6.addActionListener(formListener);
    jLabel22.setText("Please note that deriving to/from builtin components e.g. Button, TextField etc. is unreliable due to cyclic dependencies");
    // NOI18N
    jLabel22.setName("jLabel22");
    org.jdesktop.layout.GroupLayout jPanel10Layout = new org.jdesktop.layout.GroupLayout(jPanel10);
    jPanel10.setLayout(jPanel10Layout);
    jPanel10Layout.setHorizontalGroup(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel10Layout.createSequentialGroup().addContainerGap().add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel10Layout.createSequentialGroup().add(defineAttribute).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 739, Short.MAX_VALUE).add(deriveHelp6)).add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel10Layout.createSequentialGroup().add(baseStyle, 0, 843, Short.MAX_VALUE).add(18, 18, 18).add(baseStyleType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).add(jPanel10Layout.createSequentialGroup().add(jLabel22).add(0, 0, Short.MAX_VALUE))).addContainerGap()));
    jPanel10Layout.setVerticalGroup(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel10Layout.createSequentialGroup().addContainerGap().add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(defineAttribute).add(deriveHelp6)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel10Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(baseStyle, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(baseStyleType, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).add(18, 18, 18).add(jLabel22).addContainerGap(360, Short.MAX_VALUE)));
    addTabs.addTab("Derive", jPanel10);
    // NOI18N
    jPanel7.setName("jPanel7");
    jPanel7.setOpaque(false);
    buttonGroup1.add(bitmapFont);
    bitmapFont.setText("Bitmap Fonts (deprecated!)");
    bitmapFont.setEnabled(false);
    // NOI18N
    bitmapFont.setName("bitmapFont");
    bitmapFont.addActionListener(formListener);
    buttonGroup1.add(systemFont);
    systemFont.setSelected(true);
    systemFont.setText("Standard Font");
    systemFont.setEnabled(false);
    // NOI18N
    systemFont.setName("systemFont");
    systemFont.addActionListener(formListener);
    bitmapFontValue.setEnabled(false);
    // NOI18N
    bitmapFontValue.setName("bitmapFontValue");
    bitmapFontValue.setPrototypeDisplayValue("XXXXXXXXXXXXXXXX");
    bitmapFontValue.addActionListener(formListener);
    addNewBitmapFont.setText("...");
    addNewBitmapFont.setEnabled(false);
    // NOI18N
    addNewBitmapFont.setName("addNewBitmapFont");
    addNewBitmapFont.addActionListener(formListener);
    fontFace.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "SYSTEM", "MONOSPACE", "PROPORTIONAL" }));
    fontFace.setEnabled(false);
    // NOI18N
    fontFace.setName("fontFace");
    fontFace.addActionListener(formListener);
    fontStyle.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "PLAIN", "BOLD", "ITALIC", "BOLD ITALIC" }));
    fontStyle.setEnabled(false);
    // NOI18N
    fontStyle.setName("fontStyle");
    fontStyle.addActionListener(formListener);
    fontSize.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "MEDIUM", "SMALL", "LARGE" }));
    fontSize.setEnabled(false);
    // NOI18N
    fontSize.setName("fontSize");
    fontSize.addActionListener(formListener);
    deriveFont.setSelected(true);
    deriveFont.setText("Derive Font");
    // NOI18N
    deriveFont.setName("deriveFont");
    deriveFont.addActionListener(formListener);
    textDecorationCombo.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "None", "Underline", "Strike Through,", "3D Text Raised", "3D Text Lowered", "3D Shadow North" }));
    textDecorationCombo.setEnabled(false);
    // NOI18N
    textDecorationCombo.setName("textDecorationCombo");
    textDecorationCombo.addActionListener(formListener);
    deriveTextDecoration.setSelected(true);
    deriveTextDecoration.setText("Derive Text Decoration");
    // NOI18N
    deriveTextDecoration.setName("deriveTextDecoration");
    deriveTextDecoration.addActionListener(formListener);
    jLabel7.setText("Text Decoration");
    // NOI18N
    jLabel7.setName("jLabel7");
    deriveHelp7.setText("Derive Help");
    // NOI18N
    deriveHelp7.setName("deriveHelp7");
    deriveHelp7.addActionListener(formListener);
    fontHelp.setText("Font Help");
    // NOI18N
    fontHelp.setName("fontHelp");
    fontHelp.addActionListener(formListener);
    jLabel12.setText("True Type");
    jLabel12.setToolTipText("<html><body>\nTruetype fonts are only supported on some platforms (iOS/Android)<br>\nto use them you need to place the file in the src directory next to the<br>\nresource file and make sure the name of the font is correct in the<br>\ntext field (for iOS). When unavailable the standard fonts will be used.<br>\n<b>Important</b> the file name must have a .ttf extension!");
    // NOI18N
    jLabel12.setName("jLabel12");
    trueTypeFont.setToolTipText("<html><body>\nTruetype fonts are only supported on some platforms (iOS/Android)<br>\nto use them you need to place the file in the src directory next to the<br>\nresource file and make sure the name of the font is correct in the<br>\ntext field (for iOS). When unavailable the standard fonts will be used.<br>\n<b>Important</b> the file name must have a .ttf extension!");
    trueTypeFont.setEnabled(false);
    // NOI18N
    trueTypeFont.setName("trueTypeFont");
    trueTypeFont.addActionListener(formListener);
    jLabel13.setText("True Type Size");
    // NOI18N
    jLabel13.setToolTipText("<html><body>\nTruetype fonts are only supported on some platforms (iOS/Android)<br>\nto use them you need to place the file in the src directory next to the<br>\nresource file and make sure the name of the font is correct in the<br>\ntext field (for iOS). When unavailable the standard fonts will be used.<br>\n<b>Important</b> the file name must have a .ttf extension!");
    // NOI18N
    jLabel13.setName("jLabel13");
    trueTypeFontSizeOption.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Small", "Medium", "Large", "Millimeters", "Pixels" }));
    trueTypeFontSizeOption.setSelectedIndex(1);
    trueTypeFontSizeOption.setToolTipText("<html><body>\nTruetype fonts are only supported on some platforms (iOS/Android)<br>\nto use them you need to place the file in the src directory next to the<br>\nresource file and make sure the name of the font is correct in the<br>\ntext field (for iOS). When unavailable the standard fonts will be used.<br>\n<b>Important</b> the file name must have a .ttf extension!");
    trueTypeFontSizeOption.setEnabled(false);
    // NOI18N
    trueTypeFontSizeOption.setName("trueTypeFontSizeOption");
    trueTypeFontSizeOption.addActionListener(formListener);
    trueTypeFontSizeValue.setToolTipText("<html><body>\nTruetype fonts are only supported on some platforms (iOS/Android)<br>\nto use them you need to place the file in the src directory next to the<br>\nresource file and make sure the name of the font is correct in the<br>\ntext field (for iOS). When unavailable the standard fonts will be used.<br>\n<b>Important</b> the file name must have a .ttf extension!");
    trueTypeFontSizeValue.setEnabled(false);
    // NOI18N
    trueTypeFontSizeValue.setName("trueTypeFontSizeValue");
    trueTypeFontSizeValue.addChangeListener(formListener);
    org.jdesktop.layout.GroupLayout jPanel7Layout = new org.jdesktop.layout.GroupLayout(jPanel7);
    jPanel7.setLayout(jPanel7Layout);
    jPanel7Layout.setHorizontalGroup(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel7Layout.createSequentialGroup().addContainerGap().add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel7Layout.createSequentialGroup().add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING).add(org.jdesktop.layout.GroupLayout.LEADING, deriveFont).add(org.jdesktop.layout.GroupLayout.LEADING, jPanel7Layout.createSequentialGroup().add(systemFont).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(bitmapFont))).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING).add(fontHelp).add(deriveHelp7)).addContainerGap()).add(jPanel7Layout.createSequentialGroup().add(deriveTextDecoration).addContainerGap(812, Short.MAX_VALUE)).add(org.jdesktop.layout.GroupLayout.TRAILING, jPanel7Layout.createSequentialGroup().add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING).add(jPanel7Layout.createSequentialGroup().add(jLabel7).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(textDecorationCombo, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).add(org.jdesktop.layout.GroupLayout.LEADING, jPanel7Layout.createSequentialGroup().add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jLabel13).add(jLabel12).add(fontFace, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 157, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(trueTypeFont, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).add(trueTypeFontSizeOption, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).add(fontStyle, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(fontSize, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).add(trueTypeFontSizeValue))).add(org.jdesktop.layout.GroupLayout.LEADING, bitmapFontValue, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(addNewBitmapFont).add(387, 387, 387)))));
    jPanel7Layout.linkSize(new java.awt.Component[] { bitmapFont, systemFont }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
    jPanel7Layout.linkSize(new java.awt.Component[] { deriveHelp7, fontHelp }, org.jdesktop.layout.GroupLayout.HORIZONTAL);
    jPanel7Layout.setVerticalGroup(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(jPanel7Layout.createSequentialGroup().addContainerGap().add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING).add(jPanel7Layout.createSequentialGroup().add(deriveFont).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(bitmapFont).add(systemFont))).add(jPanel7Layout.createSequentialGroup().add(deriveHelp7).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(fontHelp))).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(fontFace, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(fontSize, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(fontStyle, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel12).add(trueTypeFont, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).add(9, 9, 9).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.CENTER).add(trueTypeFontSizeValue, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(trueTypeFontSizeOption, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(jLabel13)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(addNewBitmapFont).add(bitmapFontValue, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(deriveTextDecoration).addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(jPanel7Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel7).add(textDecorationCombo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).addContainerGap(227, Short.MAX_VALUE)));
    addTabs.addTab("Font", jPanel7);
    // NOI18N
    jScrollPane2.setName("jScrollPane2");
    // NOI18N
    help.setContentType("text/html");
    help.setEditable(false);
    // NOI18N
    help.setName("help");
    jScrollPane2.setViewportView(help);
    addTabs.addTab("Help", jScrollPane2);
    styleType.setText("Unselected");
    // NOI18N
    styleType.setName("styleType");
    styleHelp.setText("Component Help");
    // NOI18N
    styleHelp.setName("styleHelp");
    styleHelp.addActionListener(formListener);
    videoTutorial.setText("Video Tutorial");
    // NOI18N
    videoTutorial.setName("videoTutorial");
    videoTutorial.addActionListener(formListener);
    org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup().addContainerGap().add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING).add(org.jdesktop.layout.GroupLayout.LEADING, previewPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).add(org.jdesktop.layout.GroupLayout.LEADING, addTabs).add(org.jdesktop.layout.GroupLayout.LEADING, layout.createSequentialGroup().add(jLabel1).addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(componentName, 0, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE).add(18, 18, 18).add(styleType).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(styleHelp).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(videoTutorial)).add(org.jdesktop.layout.GroupLayout.LEADING, jLabel6)).addContainerGap()));
    layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().addContainerGap().add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel1).add(componentName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).add(styleType).add(styleHelp).add(videoTutorial)).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(addTabs).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(jLabel6).addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED).add(previewPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 92, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE).addContainerGap()));
}
Also used : JTabbedPane(javax.swing.JTabbedPane) DefaultComboBoxModel(javax.swing.DefaultComboBoxModel) JComboBox(javax.swing.JComboBox) BorderLayout(java.awt.BorderLayout) JButton(javax.swing.JButton) CodenameOneComponentWrapper(com.codename1.ui.resource.util.CodenameOneComponentWrapper)

Example 24 with TextField

use of com.codename1.ui.TextField in project CodenameOne by codenameone.

the class LazyValueC method createComponent.

private Component createComponent(DataInputStream in, Container parent, Container root, Resources res, Hashtable componentListeners, EmbeddedContainer embedded) throws Exception {
    String name = in.readUTF();
    int property = in.readInt();
    // special case for the base form
    if (property == PROPERTY_BASE_FORM) {
        String baseFormName = name;
        initBaseForm(baseFormName);
        if (!ignorBaseForm) {
            Form base = (Form) createContainer(res, baseFormName);
            Container destination = (Container) findByName("destination", base);
            // try finding an appropriate empty container if no "fixed" destination is defined
            if (destination == null) {
                destination = findEmptyContainer(base.getContentPane());
                if (destination == null) {
                    System.out.println("Couldn't find appropriate 'destination' container in base form: " + baseFormName);
                    return null;
                }
            }
            root = base;
            Component cmp = createComponent(in, destination, root, res, componentListeners, embedded);
            if (destination.getLayout() instanceof BorderLayout) {
                destination.addComponent(BorderLayout.CENTER, cmp);
            } else {
                destination.addComponent(cmp);
            }
            return root;
        } else {
            name = in.readUTF();
            property = in.readInt();
        }
    }
    Component cmp = createComponentType(name);
    if (componentListeners != null) {
        Object listeners = componentListeners.get(name);
        if (listeners != null) {
            if (listeners instanceof Vector) {
                Vector v = (Vector) listeners;
                for (int iter = 0; iter < v.size(); iter++) {
                    bindListenerToComponent(cmp, v.elementAt(iter));
                }
            } else {
                bindListenerToComponent(cmp, listeners);
            }
        }
    }
    Component actualLead = cmp;
    if (actualLead instanceof Container) {
        Container cnt = (Container) actualLead;
        actualLead = cnt.getLeadComponent();
        if (actualLead == null) {
            actualLead = cmp;
        }
    }
    if (actualLead instanceof Button) {
        ActionListener l = getFormListenerInstance(root, embedded);
        if (l != null) {
            ((Button) actualLead).addActionListener(l);
        }
    } else {
        if (actualLead instanceof TextArea) {
            ActionListener l = getFormListenerInstance(root, embedded);
            if (l != null) {
                ((TextArea) actualLead).addActionListener(l);
            }
        } else {
            if (actualLead instanceof List) {
                ActionListener l = getFormListenerInstance(root, embedded);
                if (l != null) {
                    ((List) actualLead).addActionListener(l);
                }
            } else {
                if (actualLead instanceof ContainerList) {
                    ActionListener l = getFormListenerInstance(root, embedded);
                    if (l != null) {
                        ((ContainerList) actualLead).addActionListener(l);
                    }
                } else {
                    if (actualLead instanceof com.codename1.ui.Calendar) {
                        ActionListener l = getFormListenerInstance(root, embedded);
                        if (l != null) {
                            ((com.codename1.ui.Calendar) actualLead).addActionListener(l);
                        }
                    }
                }
            }
        }
    }
    cmp.putClientProperty(TYPE_KEY, name);
    if (root == null) {
        root = (Container) cmp;
    }
    while (property != -1) {
        modifyingProperty(cmp, property);
        switch(property) {
            case PROPERTY_CUSTOM:
                String customPropertyName = in.readUTF();
                modifyingCustomProperty(cmp, customPropertyName);
                boolean isNull = in.readBoolean();
                if (isNull) {
                    cmp.setPropertyValue(customPropertyName, null);
                    break;
                }
                boolean cl = cmp instanceof ContainerList;
                String[] propertyNames = cmp.getPropertyNames();
                for (int iter = 0; iter < propertyNames.length; iter++) {
                    if (propertyNames[iter].equals(customPropertyName)) {
                        Class type = cmp.getPropertyTypes()[iter];
                        String[] typeNames = cmp.getPropertyTypeNames();
                        String typeName = null;
                        if (typeNames != null && typeNames.length > iter) {
                            typeName = typeNames[iter];
                        }
                        Object value = readCustomPropertyValue(in, type, typeName, res, propertyNames[iter]);
                        if (cl && customPropertyName.equals("ListItems") && setListModel((ContainerList) cmp)) {
                            break;
                        }
                        cmp.setPropertyValue(customPropertyName, value);
                        break;
                    }
                }
                break;
            case PROPERTY_EMBED:
                root.putClientProperty(EMBEDDED_FORM_FLAG, "");
                ((EmbeddedContainer) cmp).setEmbed(in.readUTF());
                Container embed = createContainer(res, ((EmbeddedContainer) cmp).getEmbed(), (EmbeddedContainer) cmp);
                if (embed != null) {
                    if (embed instanceof Form) {
                        embed = formToContainer((Form) embed);
                    }
                    ((EmbeddedContainer) cmp).addComponent(BorderLayout.CENTER, embed);
                    // this isn't exactly the "right thing" but its the best we can do to make all
                    // use cases work
                    beforeShowContainer(embed);
                    postShowContainer(embed);
                }
                break;
            case PROPERTY_TOGGLE_BUTTON:
                ((Button) cmp).setToggle(in.readBoolean());
                break;
            case PROPERTY_RADIO_GROUP:
                ((RadioButton) cmp).setGroup(in.readUTF());
                break;
            case PROPERTY_SELECTED:
                boolean isSelected = in.readBoolean();
                if (cmp instanceof RadioButton) {
                    ((RadioButton) cmp).setSelected(isSelected);
                } else {
                    ((CheckBox) cmp).setSelected(isSelected);
                }
                break;
            case PROPERTY_SCROLLABLE_X:
                ((Container) cmp).setScrollableX(in.readBoolean());
                break;
            case PROPERTY_SCROLLABLE_Y:
                ((Container) cmp).setScrollableY(in.readBoolean());
                break;
            case PROPERTY_TENSILE_DRAG_ENABLED:
                cmp.setTensileDragEnabled(in.readBoolean());
                break;
            case PROPERTY_TACTILE_TOUCH:
                cmp.setTactileTouch(in.readBoolean());
                break;
            case PROPERTY_SNAP_TO_GRID:
                cmp.setSnapToGrid(in.readBoolean());
                break;
            case PROPERTY_FLATTEN:
                cmp.setFlatten(in.readBoolean());
                break;
            case PROPERTY_TEXT:
                if (cmp instanceof Label) {
                    ((Label) cmp).setText(in.readUTF());
                } else {
                    ((TextArea) cmp).setText(in.readUTF());
                }
                break;
            case PROPERTY_TEXT_MAX_LENGTH:
                ((TextArea) cmp).setMaxSize(in.readInt());
                break;
            case PROPERTY_TEXT_CONSTRAINT:
                ((TextArea) cmp).setConstraint(in.readInt());
                if (cmp instanceof TextField) {
                    int cons = ((TextArea) cmp).getConstraint();
                    if ((cons & TextArea.NUMERIC) == TextArea.NUMERIC) {
                        ((TextField) cmp).setInputModeOrder(new String[] { "123" });
                    }
                }
                break;
            case PROPERTY_ALIGNMENT:
                if (cmp instanceof Label) {
                    ((Label) cmp).setAlignment(in.readInt());
                } else {
                    ((TextArea) cmp).setAlignment(in.readInt());
                }
                break;
            case PROPERTY_TEXT_AREA_GROW:
                ((TextArea) cmp).setGrowByContent(in.readBoolean());
                break;
            case PROPERTY_LAYOUT:
                Layout layout = null;
                switch(in.readShort()) {
                    case LAYOUT_BORDER_LEGACY:
                        layout = new BorderLayout();
                        break;
                    case LAYOUT_BORDER_ANOTHER_LEGACY:
                        {
                            BorderLayout b = new BorderLayout();
                            if (in.readBoolean()) {
                                b.defineLandscapeSwap(BorderLayout.NORTH, in.readUTF());
                            }
                            if (in.readBoolean()) {
                                b.defineLandscapeSwap(BorderLayout.EAST, in.readUTF());
                            }
                            if (in.readBoolean()) {
                                b.defineLandscapeSwap(BorderLayout.WEST, in.readUTF());
                            }
                            if (in.readBoolean()) {
                                b.defineLandscapeSwap(BorderLayout.SOUTH, in.readUTF());
                            }
                            if (in.readBoolean()) {
                                b.defineLandscapeSwap(BorderLayout.CENTER, in.readUTF());
                            }
                            layout = b;
                            break;
                        }
                    case LAYOUT_BORDER:
                        {
                            BorderLayout b = new BorderLayout();
                            if (in.readBoolean()) {
                                b.defineLandscapeSwap(BorderLayout.NORTH, in.readUTF());
                            }
                            if (in.readBoolean()) {
                                b.defineLandscapeSwap(BorderLayout.EAST, in.readUTF());
                            }
                            if (in.readBoolean()) {
                                b.defineLandscapeSwap(BorderLayout.WEST, in.readUTF());
                            }
                            if (in.readBoolean()) {
                                b.defineLandscapeSwap(BorderLayout.SOUTH, in.readUTF());
                            }
                            if (in.readBoolean()) {
                                b.defineLandscapeSwap(BorderLayout.CENTER, in.readUTF());
                            }
                            b.setAbsoluteCenter(in.readBoolean());
                            layout = b;
                            break;
                        }
                    case LAYOUT_BOX_X:
                        layout = new BoxLayout(BoxLayout.X_AXIS);
                        break;
                    case LAYOUT_BOX_Y:
                        layout = new BoxLayout(BoxLayout.Y_AXIS);
                        break;
                    case LAYOUT_FLOW_LEGACY:
                        layout = new FlowLayout();
                        break;
                    case LAYOUT_FLOW:
                        FlowLayout f = new FlowLayout();
                        f.setFillRows(in.readBoolean());
                        f.setAlign(in.readInt());
                        f.setValign(in.readInt());
                        layout = f;
                        break;
                    case LAYOUT_LAYERED:
                        layout = new LayeredLayout();
                        break;
                    case LAYOUT_GRID:
                        layout = new GridLayout(in.readInt(), in.readInt());
                        break;
                    case LAYOUT_TABLE:
                        layout = new TableLayout(in.readInt(), in.readInt());
                        break;
                }
                ((Container) cmp).setLayout(layout);
                break;
            case PROPERTY_TAB_PLACEMENT:
                ((Tabs) cmp).setTabPlacement(in.readInt());
                break;
            case PROPERTY_TAB_TEXT_POSITION:
                ((Tabs) cmp).setTabTextPosition(in.readInt());
                break;
            case PROPERTY_PREFERRED_WIDTH:
                cmp.setPreferredW(in.readInt());
                break;
            case PROPERTY_PREFERRED_HEIGHT:
                cmp.setPreferredH(in.readInt());
                break;
            case PROPERTY_UIID:
                cmp.setUIID(in.readUTF());
                break;
            case PROPERTY_DIALOG_UIID:
                ((Dialog) cmp).setDialogUIID(in.readUTF());
                break;
            case PROPERTY_DISPOSE_WHEN_POINTER_OUT:
                ((Dialog) cmp).setDisposeWhenPointerOutOfBounds(in.readBoolean());
                break;
            case PROPERTY_CLOUD_BOUND_PROPERTY:
                cmp.setCloudBoundProperty(in.readUTF());
                break;
            case PROPERTY_CLOUD_DESTINATION_PROPERTY:
                cmp.setCloudDestinationProperty(in.readUTF());
                break;
            case PROPERTY_DIALOG_POSITION:
                String pos = in.readUTF();
                if (pos.length() > 0) {
                    ((Dialog) cmp).setDialogPosition(pos);
                }
                break;
            case PROPERTY_FOCUSABLE:
                cmp.setFocusable(in.readBoolean());
                break;
            case PROPERTY_ENABLED:
                cmp.setEnabled(in.readBoolean());
                break;
            case PROPERTY_SCROLL_VISIBLE:
                cmp.setScrollVisible(in.readBoolean());
                break;
            case PROPERTY_ICON:
                ((Label) cmp).setIcon(res.getImage(in.readUTF()));
                break;
            case PROPERTY_ROLLOVER_ICON:
                ((Button) cmp).setRolloverIcon(res.getImage(in.readUTF()));
                break;
            case PROPERTY_PRESSED_ICON:
                ((Button) cmp).setPressedIcon(res.getImage(in.readUTF()));
                break;
            case PROPERTY_DISABLED_ICON:
                ((Button) cmp).setDisabledIcon(res.getImage(in.readUTF()));
                break;
            case PROPERTY_GAP:
                ((Label) cmp).setGap(in.readInt());
                break;
            case PROPERTY_VERTICAL_ALIGNMENT:
                if (cmp instanceof TextArea) {
                    ((TextArea) cmp).setVerticalAlignment(in.readInt());
                } else {
                    ((Label) cmp).setVerticalAlignment(in.readInt());
                }
                break;
            case PROPERTY_TEXT_POSITION:
                ((Label) cmp).setTextPosition(in.readInt());
                break;
            case PROPERTY_CLIENT_PROPERTIES:
                int count = in.readInt();
                StringBuilder sb = new StringBuilder();
                for (int iter = 0; iter < count; iter++) {
                    String k = in.readUTF();
                    String v = in.readUTF();
                    cmp.putClientProperty(k, v);
                    sb.append(k);
                    if (iter < count - 1) {
                        sb.append(",");
                    }
                }
                cmp.putClientProperty("cn1$Properties", sb.toString());
                break;
            case PROPERTY_NAME:
                String componentName = in.readUTF();
                cmp.setName(componentName);
                root.putClientProperty("%" + componentName + "%", cmp);
                break;
            case PROPERTY_LAYOUT_CONSTRAINT:
                if (parent.getLayout() instanceof BorderLayout) {
                    cmp.putClientProperty("layoutConstraint", in.readUTF());
                } else {
                    TableLayout tl = (TableLayout) parent.getLayout();
                    TableLayout.Constraint con = tl.createConstraint(in.readInt(), in.readInt());
                    con.setHeightPercentage(in.readInt());
                    con.setWidthPercentage(in.readInt());
                    con.setHorizontalAlign(in.readInt());
                    con.setHorizontalSpan(in.readInt());
                    con.setVerticalAlign(in.readInt());
                    con.setVerticalSpan(in.readInt());
                    cmp.putClientProperty("layoutConstraint", con);
                }
                break;
            case PROPERTY_TITLE:
                ((Form) cmp).setTitle(in.readUTF());
                break;
            case PROPERTY_COMPONENTS:
                int componentCount = in.readInt();
                if (cmp instanceof Tabs) {
                    for (int iter = 0; iter < componentCount; iter++) {
                        String tab = in.readUTF();
                        Component child = createComponent(in, (Container) cmp, root, res, componentListeners, embedded);
                        ((Tabs) cmp).addTab(tab, child);
                    }
                } else {
                    for (int iter = 0; iter < componentCount; iter++) {
                        Component child = createComponent(in, (Container) cmp, root, res, componentListeners, embedded);
                        Object con = child.getClientProperty("layoutConstraint");
                        if (con != null) {
                            ((Container) cmp).addComponent(con, child);
                        } else {
                            ((Container) cmp).addComponent(child);
                        }
                    }
                }
                break;
            case PROPERTY_COLUMNS:
                ((TextArea) cmp).setColumns(in.readInt());
                break;
            case PROPERTY_ROWS:
                ((TextArea) cmp).setRows(in.readInt());
                break;
            case PROPERTY_HINT:
                if (cmp instanceof List) {
                    ((List) cmp).setHint(in.readUTF());
                } else {
                    ((TextArea) cmp).setHint(in.readUTF());
                }
                break;
            case PROPERTY_HINT_ICON:
                if (cmp instanceof List) {
                    ((List) cmp).setHintIcon(res.getImage(in.readUTF()));
                } else {
                    ((TextArea) cmp).setHintIcon(res.getImage(in.readUTF()));
                }
                break;
            case PROPERTY_ITEM_GAP:
                ((List) cmp).setItemGap(in.readInt());
                break;
            case PROPERTY_LIST_FIXED:
                ((List) cmp).setFixedSelection(in.readInt());
                break;
            case PROPERTY_LIST_ORIENTATION:
                ((List) cmp).setOrientation(in.readInt());
                break;
            case PROPERTY_LIST_ITEMS_LEGACY:
                String[] items = new String[in.readInt()];
                for (int iter = 0; iter < items.length; iter++) {
                    items[iter] = in.readUTF();
                }
                if (!setListModel(((List) cmp))) {
                    ((List) cmp).setModel(new DefaultListModel((Object[]) items));
                }
                break;
            case PROPERTY_LIST_ITEMS:
                Object[] elements = readObjectArrayForListModel(in, res);
                if (!setListModel(((List) cmp))) {
                    ((List) cmp).setModel(new DefaultListModel(elements));
                }
                break;
            case PROPERTY_LIST_RENDERER:
                if (cmp instanceof ContainerList) {
                    ((ContainerList) cmp).setRenderer(readRendererer(res, in));
                } else {
                    ((List) cmp).setRenderer(readRendererer(res, in));
                }
                break;
            case PROPERTY_NEXT_FORM:
                String nextForm = in.readUTF();
                setNextForm(cmp, nextForm, res, root);
                break;
            case PROPERTY_COMMANDS:
                readCommands(in, cmp, res, false);
                break;
            case PROPERTY_COMMANDS_LEGACY:
                readCommands(in, cmp, res, true);
                break;
            case PROPERTY_CYCLIC_FOCUS:
                ((Form) cmp).setCyclicFocus(in.readBoolean());
                break;
            case PROPERTY_RTL:
                cmp.setRTL(in.readBoolean());
                break;
            case PROPERTY_SLIDER_THUMB:
                ((Slider) cmp).setThumbImage(res.getImage(in.readUTF()));
                break;
            case PROPERTY_INFINITE:
                ((Slider) cmp).setInfinite(in.readBoolean());
                break;
            case PROPERTY_PROGRESS:
                ((Slider) cmp).setProgress(in.readInt());
                break;
            case PROPERTY_VERTICAL:
                ((Slider) cmp).setVertical(in.readBoolean());
                break;
            case PROPERTY_EDITABLE:
                if (cmp instanceof TextArea) {
                    ((TextArea) cmp).setEditable(in.readBoolean());
                } else {
                    ((Slider) cmp).setEditable(in.readBoolean());
                }
                break;
            case PROPERTY_INCREMENTS:
                ((Slider) cmp).setIncrements(in.readInt());
                break;
            case PROPERTY_RENDER_PERCENTAGE_ON_TOP:
                ((Slider) cmp).setRenderPercentageOnTop(in.readBoolean());
                break;
            case PROPERTY_MAX_VALUE:
                ((Slider) cmp).setMaxValue(in.readInt());
                break;
            case PROPERTY_MIN_VALUE:
                ((Slider) cmp).setMinValue(in.readInt());
                break;
        }
        property = in.readInt();
    }
    postCreateComponent(cmp);
    return cmp;
}
Also used : FlowLayout(com.codename1.ui.layouts.FlowLayout) Slider(com.codename1.ui.Slider) Form(com.codename1.ui.Form) TextArea(com.codename1.ui.TextArea) ContainerList(com.codename1.ui.list.ContainerList) BoxLayout(com.codename1.ui.layouts.BoxLayout) Label(com.codename1.ui.Label) DefaultListModel(com.codename1.ui.list.DefaultListModel) Container(com.codename1.ui.Container) GridLayout(com.codename1.ui.layouts.GridLayout) BorderLayout(com.codename1.ui.layouts.BorderLayout) Button(com.codename1.ui.Button) RadioButton(com.codename1.ui.RadioButton) Dialog(com.codename1.ui.Dialog) TextField(com.codename1.ui.TextField) List(com.codename1.ui.List) ContainerList(com.codename1.ui.list.ContainerList) Component(com.codename1.ui.Component) LayeredLayout(com.codename1.ui.layouts.LayeredLayout) Vector(java.util.Vector) TableLayout(com.codename1.ui.table.TableLayout) RadioButton(com.codename1.ui.RadioButton) ActionListener(com.codename1.ui.events.ActionListener) BoxLayout(com.codename1.ui.layouts.BoxLayout) LayeredLayout(com.codename1.ui.layouts.LayeredLayout) GridLayout(com.codename1.ui.layouts.GridLayout) FlowLayout(com.codename1.ui.layouts.FlowLayout) BorderLayout(com.codename1.ui.layouts.BorderLayout) Layout(com.codename1.ui.layouts.Layout) TableLayout(com.codename1.ui.table.TableLayout) CheckBox(com.codename1.ui.CheckBox) Tabs(com.codename1.ui.Tabs)

Example 25 with TextField

use of com.codename1.ui.TextField in project CodenameOne by codenameone.

the class Table method createCell.

/**
 * Creates a cell based on the given value
 *
 * @param value the new value object
 * @param row row number, -1 for the header rows
 * @param column column number
 * @param editable true if the cell is editable
 * @return cell component instance
 */
protected Component createCell(Object value, int row, final int column, boolean editable) {
    if (row == -1) {
        Button header = new Button((String) value, getUIID() + "Header");
        header.getAllStyles().setAlignment(titleAlignment);
        header.setTextPosition(LEFT);
        if (isSortSupported()) {
            header.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent evt) {
                    Comparator cmp = createColumnSortComparator(column);
                    if (cmp == null) {
                        return;
                    }
                    if (column == sortedColumn) {
                        ascending = !ascending;
                    } else {
                        sortedColumn = column;
                        ascending = false;
                    }
                    setModel(new SortableTableModel(sortedColumn, ascending, model, cmp));
                }
            });
            if (sortedColumn == column) {
                if (ascending) {
                    FontImage.setMaterialIcon(header, FontImage.MATERIAL_ARROW_DROP_UP);
                } else {
                    FontImage.setMaterialIcon(header, FontImage.MATERIAL_ARROW_DROP_DOWN);
                }
            }
        }
        return header;
    }
    if (editable) {
        TextField cell = new TextField("" + value, -1);
        cell.setLeftAndRightEditingTrigger(false);
        cell.setUIID(getUIID() + "Cell");
        return cell;
    }
    Label cell = new Label("" + value);
    cell.setUIID(getUIID() + "Cell");
    cell.getUnselectedStyle().setAlignment(cellAlignment);
    cell.getSelectedStyle().setAlignment(cellAlignment);
    cell.setFocusable(true);
    return cell;
}
Also used : ActionListener(com.codename1.ui.events.ActionListener) Button(com.codename1.ui.Button) ActionEvent(com.codename1.ui.events.ActionEvent) Label(com.codename1.ui.Label) TextField(com.codename1.ui.TextField) Comparator(java.util.Comparator)

Aggregations

TextField (com.codename1.ui.TextField)19 Component (com.codename1.ui.Component)16 TextArea (com.codename1.ui.TextArea)10 Button (com.codename1.ui.Button)8 Container (com.codename1.ui.Container)6 Label (com.codename1.ui.Label)6 RadioButton (com.codename1.ui.RadioButton)6 Form (com.codename1.ui.Form)5 ActionListener (com.codename1.ui.events.ActionListener)5 BorderLayout (com.codename1.ui.layouts.BorderLayout)5 CheckBox (com.codename1.ui.CheckBox)4 ActionEvent (com.codename1.ui.events.ActionEvent)4 BoxLayout (com.codename1.ui.layouts.BoxLayout)4 FlowLayout (com.codename1.ui.layouts.FlowLayout)3 Paint (android.graphics.Paint)2 SpannableStringBuilder (android.text.SpannableStringBuilder)2 List (com.codename1.ui.List)2 Slider (com.codename1.ui.Slider)2 SelectionListener (com.codename1.ui.events.SelectionListener)2 LayeredLayout (com.codename1.ui.layouts.LayeredLayout)2