shapes

How to display a color selector when clicking a button?

不问归期 提交于 2019-11-29 05:16:43
I'm making a program that draws some shapes and fills them with color. I need to change the 'line' color, and want the user to be able to select the color. How can I, when clicking a button "Choose Color", have a set of colours appear below the button? Is it possible for the selector to be embedded in the UI below the button (and not pop up in a window)? I want to display a color selector like in Paint. Here is a colour selection button class: shows current selected color opens a JColorChooser dialog when pressed fires events when a color is selected Use it in this way: ColorChooserButton

Draw Beautiful Speech Bubbles in Swing [closed]

╄→гoц情女王★ 提交于 2019-11-29 05:14:47
I am trying to create beautiful speech bubbles in swing but the result is not very good...I mean I want something better and more beautiful! here is the code i'm using: import javax.swing.*; import java.awt.*; import java.awt.geom.Area; import java.awt.geom.RoundRectangle2D; public class BubbleTest { public static void main(String[] args) { try { for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(info.getName())) { javax.swing.UIManager.setLookAndFeel(info.getClassName()); break; } } } catch (ClassNotFoundException |

WPF Rectangle does not have a Click event

大憨熊 提交于 2019-11-28 23:05:12
It seems that the WPF Rectangle shape does not have the Click event defined. What am I supposed to use instead? It does have MouseUp, but it's not quite the same behavior. Kent Boogaart If you're not happy with MouseDown and MouseUp , perhaps you could just put the Rectangle in a Button and handle the Button 's Click event? <Button> <Button.Template> <ControlTemplate> <Rectangle .../> </ControlTemplate> </Button.Template> </Button> It really depends with the behavior you're after. Please elaborate if needs be. To add click handing to a Rectangle itself, you can use the InputBindings property:

Generating multidimensional data

霸气de小男生 提交于 2019-11-28 21:28:00
Does R have a package for generating random numbers in multi-dimensional space? For example, suppose I want to generate 1000 points inside a cuboid or a sphere. Also check out the copula package. This will generate data within a cube/hypercube with uniform margins, but with correlation structures that you set. The generated variables can then be transformed to represent other shapes, but still with relations other than independent. If you want more complex shapes but are happy with uniform and idependent within the shape then you can just do rejection sampling: generate data within a cube that

Drawing multiple shapes with ShapeDrawable in xml with Android

会有一股神秘感。 提交于 2019-11-28 17:22:29
问题 I am currently drawing a number of circles on a canvas in a custom view in code. the circles are static and do not change. I would like to draw them using a ShapeDrawable in xml to help clean up my code. I will have a number of different drawables which the user can select and therefore I don't want to do this in code. having 3 or 4 xml drawables seems a lot neater to me. I have created one circle in xml using a ShapeDrawable but am unable to add more than one shape to the xml. How do I add

Border in shape xml

ぐ巨炮叔叔 提交于 2019-11-28 15:33:02
I am trying to make a drawable to use for a button. I would like it to have this coloring, with a 2px border around it. Everything works just fine except I cannot get the border to show up... <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" > <gradient android:startColor="@color/bar_clicked_dark" android:endColor="@color/bar_clicked_light" android:angle="90"/> <corners android:bottomLeftRadius="0dp" android:topLeftRadius="15dp" android:bottomRightRadius="15dp" android:topRightRadius="0dp" /> <stroke android:width

Multipe shapes inside shapes.xml in android

三世轮回 提交于 2019-11-28 12:14:20
I have been searching for possibilities to define different shapes inside a single shapes.xml and refer to each one on some specific events. At last I've found a solution to my question. And the answer is using level-list. <?xml version="1.0" encoding="utf-8"?> <level-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:maxLevel="0"> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#aaa" android:endColor="#eee" android:angle="270" /> <corners android:bottomRightRadius="7dp" android

How to save Word Shapes to image using VBA?

人盡茶涼 提交于 2019-11-28 06:27:24
问题 I have a simple requirement to save MS-Office Drawing Objects embedded within a Word Doc to image files. The following code worked for image extraction from Powerpoint. However it does not work for MS-Word if I modify the ActivePresentation to ActiveDocument. The Export method was not available for shape object. Any ideas? Dim oPPTShap as Shape For k = 1 To .Slides(intSlide).Shapes.Count Set oPPTShape = ActivePresentation.Slides(intSlide).Shapes(k) oPPTShape.Export "C:\images\s" & k & ".bmp",

Defining Drawable Shape with in JAVA code

杀马特。学长 韩版系。学妹 提交于 2019-11-28 06:16:34
问题 Hi Can I define this shape without using xml code <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <gradient android:startColor="#34342C" android:endColor="#848486" android:angle="90" /> <padding android:left="7dp" android:top="5dp" android:right="7dp" android:bottom="5dp" /> <stroke android:width="1dp" android:color="#FFFFFF" /> </shape> Thanks for your help 回答1: Yes use a ShapeDrawable to draw your rectangle with the padding you require using a

Does an HTML5 canvas always have to be a rectangle?

房东的猫 提交于 2019-11-28 06:01:27
问题 The reason I'm interested in canvases having any shape is that it would then be possible to cut out images with Bezier curves and have the text of a web page flow around the canvas shape, i.e. cut-out image. What is needed is the possibility to have a free-form shaped div, SVG and HTML5 canvas. (Applied to SVG, I understand this would be equivalent to Flash symbols.) You could then imagine applying a box model (padding, border and margin) for shapes, but it wouldn't be a box (it would be