Download Jar. Uses 3874K of libraries. Click here for Pure Java version (2686L/19K).
1 | !7 |
2 | |
3 | import javax.swing.plaf.LayerUI; |
4 | |
5 | sclass BlurLayerUI extends LayerUI<JComponent> { |
6 | BufferedImage mOffscreenImage; |
7 | BufferedImageOp mOperation; |
8 | |
9 | *() { |
10 | float ninth = 1.0f / 9.0f; |
11 | float[] blurKernel = { |
12 | ninth, ninth, ninth, |
13 | ninth, ninth, ninth, |
14 | ninth, ninth, ninth |
15 | }; |
16 | mOperation = new ConvolveOp(new Kernel(3, 3, blurKernel), ConvolveOp.EDGE_NO_OP, null); |
17 | } |
18 | |
19 | public void paint(Graphics g, JComponent c) { |
20 | int w = c.getWidth(); |
21 | int h = c.getHeight(); |
22 | if (w == 0 || h == 0) ret; |
23 | |
24 | // Only create the offscreen image if the one we have |
25 | // is the wrong size. |
26 | if (mOffscreenImage == null || |
27 | mOffscreenImage.getWidth() != w || |
28 | mOffscreenImage.getHeight() != h) { |
29 | mOffscreenImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); |
30 | } |
31 | |
32 | Graphics2D ig2 = mOffscreenImage.createGraphics(); |
33 | ig2.setClip(g.getClip()); |
34 | super.paint(ig2, c); |
35 | ig2.dispose(); |
36 | |
37 | ((Graphics2D) g).drawImage(mOffscreenImage, mOperation, 0, 0); |
38 | } |
39 | } |
40 | |
41 | p-substance { |
42 | LayerUI<JComponent> layerUI = new BlurLayerUI(); |
43 | JPanel panel = createPanel(); |
44 | JLayer<JComponent> jlayer = new JLayer<JComponent>(panel, layerUI); |
45 | centerFrame(setFrameSize(showFrame("Myopia", jlayer), 300, 200)); |
46 | hideConsole(); |
47 | } |
48 | |
49 | static JPanel createPanel() { |
50 | JPanel p = new JPanel(); |
51 | |
52 | ButtonGroup entreeGroup = new ButtonGroup(); |
53 | JRadioButton radioButton; |
54 | p.add(radioButton = new JRadioButton("Beef", true)); |
55 | entreeGroup.add(radioButton); |
56 | p.add(radioButton = new JRadioButton("Chicken")); |
57 | entreeGroup.add(radioButton); |
58 | p.add(radioButton = new JRadioButton("Vegetable")); |
59 | entreeGroup.add(radioButton); |
60 | |
61 | p.add(new JCheckBox("Ketchup")); |
62 | p.add(new JCheckBox("Mustard")); |
63 | p.add(new JCheckBox("Pickles")); |
64 | |
65 | p.add(new JLabel("Special requests:")); |
66 | p.add(new JTextField(20)); |
67 | |
68 | JButton orderButton = new JButton("Place Order"); |
69 | p.add(orderButton); |
70 | |
71 | return p; |
72 | } |
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1009901 |
Snippet name: | Blurry Swing [OK] |
Eternal ID of this version: | #1009901/4 |
Text MD5: | be504e215dbbc90b9e91eba2978675bb |
Transpilation MD5: | 55e4e016cdc25f7b85bc0c56125be586 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-08-24 04:06:51 |
Source code size: | 2020 bytes / 72 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 600 / 1307 |
Version history: | 3 change(s) |
Referenced in: | [show references] |