Skip to content

Instantly share code, notes, and snippets.

@Sciss
Created April 22, 2013 14:05
Show Gist options
  • Save Sciss/5435375 to your computer and use it in GitHub Desktop.
Save Sciss/5435375 to your computer and use it in GitHub Desktop.
import javax.swing._
import java.awt._
val styles = Vector("square", "gradient", "bevel", "textured", "roundRect", "recessed", "help", "segmented", "segmentedRoundRect", "segmentedCapsule", "segmentedTextured", "segmentedGradient")
val p = new JPanel(new FlowLayout())
styles.foreach { style =>
val b = new JButton()
if (style != "help") b.setText(style)
b.putClientProperty("JButton.buttonType", style)
if (style.startsWith("segmented"))
b.putClientProperty("JButton.segmentPosition", "only")
b.setFocusable(false)
p.add(b)
}
val f = new JFrame()
f.getContentPane.add(p, BorderLayout.CENTER)
f.setResizable(false)
f.pack()
f.setLocationRelativeTo(null)
f.setVisible(true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment