Search in sources :

Example 6 with RoundedBorder

use of com.servoy.j2db.util.gui.RoundedBorder in project servoy-client by Servoy.

the class JSSolutionModel method createRoundedBorder.

/**
 * Create a special matte border string.
 *
 * @sample
 * var form = solutionModel.getForm("someForm");
 * // create a rectangle border (no rounded corners) and continous line
 * form.borderType = solutionModel.createSpecialMatteBorder(1,1,1,1,"#00ff00","#00ff00","#00ff00","#00ff00",0,null);
 * // create a border with rounded corners and dashed line (25 pixels drawn, then 25 pixels skipped)
 * // rounding_radius is an array of up to 8 numbers, order is: top-left,top-right,bottom-right,bottom-left (repetead twice - for width and height)
 * // form.borderType = solutionModel.createSpecialMatteBorder(1,1,1,1,"#00ff00","#00ff00","#00ff00","#00ff00",new Array(10,10,10,10),new Array(25,25));
 *
 * @param top_width top width of matte border in pixels
 * @param right_width right width of matte border in pixels
 * @param bottom_width bottom width of matte border in pixels
 * @param left_width left width of matte border in pixels
 * @param top_color top border color
 * @param right_color right border color
 * @param bottom_color bottom border color
 * @param left_color left border color
 * @param rounding_radius array with width/height of the arc to round the corners
 * @param border_style the border styles for the four margins(top/left/bottom/left)
 */
@JSFunction
public String createRoundedBorder(int top_width, int right_width, int bottom_width, int left_width, String top_color, String right_color, String bottom_color, String left_color, float[] rounding_radius, String[] border_style) {
    RoundedBorder border = new RoundedBorder(top_width, left_width, bottom_width, right_width, PersistHelper.createColor(top_color), PersistHelper.createColor(right_color), PersistHelper.createColor(bottom_color), PersistHelper.createColor(left_color));
    border.setRoundingRadius(rounding_radius);
    if (border_style != null)
        border.setBorderStyles(border_style);
    return ComponentFactoryHelper.createBorderString(border);
}
Also used : RoundedBorder(com.servoy.j2db.util.gui.RoundedBorder) JSFunction(org.mozilla.javascript.annotations.JSFunction)

Aggregations

RoundedBorder (com.servoy.j2db.util.gui.RoundedBorder)6 SpecialMatteBorder (com.servoy.j2db.util.gui.SpecialMatteBorder)5 Color (java.awt.Color)4 Insets (java.awt.Insets)4 BevelBorder (javax.swing.border.BevelBorder)4 EtchedBorder (javax.swing.border.EtchedBorder)4 Font (java.awt.Font)3 StringTokenizer (java.util.StringTokenizer)3 Border (javax.swing.border.Border)3 EmptyBorder (javax.swing.border.EmptyBorder)3 LineBorder (javax.swing.border.LineBorder)3 MatteBorder (javax.swing.border.MatteBorder)3 TitledBorder (javax.swing.border.TitledBorder)3 CompoundBorder (javax.swing.border.CompoundBorder)2 JSONObject (org.json.JSONObject)2 CustomBevelBorder (com.servoy.j2db.util.gui.CustomBevelBorder)1 CustomEtchedBorder (com.servoy.j2db.util.gui.CustomEtchedBorder)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 JSFunction (org.mozilla.javascript.annotations.JSFunction)1