Java Code Examples for freeseawind.ninepatch.swing.SwingNinePatch

The following examples show how to use freeseawind.ninepatch.swing.SwingNinePatch. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public NinePatchImageIcon(URL urlRes) {
	BufferedImage img = null;
	try {
	    img = ImageIO.read(urlRes);
	    mNinePatch = new SwingNinePatch(img);
	} catch (IOException e) {
	}
	
}
 
Example 2
Source Project: littleluck   Source File: LuckInternalFrameTitlePane.java    License: Apache License 2.0 5 votes vote down vote up
public LuckInternalFrameTitlePane(JInternalFrame f)
{
    super(f);

    Object obj = UIManager.get(LuckInternalFrameUIBundle.TITLEPANEL_BG_IMG);

    if(obj != null)
    {
        np = new SwingNinePatch((BufferedImage) obj);
    }
}
 
Example 3
Source Project: NinePatch   Source File: SwingTest.java    License: Apache License 2.0 4 votes vote down vote up
public static void main(String[] args)
{
    EventQueue.invokeLater(new Runnable()
    {
        public void run()
        {
            try
            {
            	InputStream input = SwingTest.class.getResourceAsStream("/progressbar_cell.9.png");
            	
                final BufferedImage img = ImageIO.read(input);

                JFrame frame = new JFrame();
                
                frame.setTitle("NinePatch Test");

                final SwingNinePatch np = new SwingNinePatch(img);

                frame.setContentPane(new JPanel()
                {
		private static final long serialVersionUID = 4553891044949357197L;

		@Override
                    protected void paintComponent(Graphics g)
                    {
                        super.paintComponent(g);

                        Graphics2D g2d = (Graphics2D)g;

                        np.drawNinePatch(g2d, 28, 28, 200, 200);
                    }
                });

                frame.setSize(480, 360);

                frame.setVisible(true);
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
        }
    });
}
 
Example 4
Source Project: littleluck   Source File: LuckUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static SwingNinePatch createNinePatch(String imageKey)
{
    return new SwingNinePatch(getUiImage(imageKey));
}
 
Example 5
Source Project: littleluck   Source File: LuckUtils.java    License: Apache License 2.0 4 votes vote down vote up
public static SwingNinePatch createNinePatch(String imageKey, RepeatType type)
{
    return new SwingNinePatch(getUiImage(imageKey), type);
}
 
Example 6
Source Project: littleluck   Source File: LuckNinePatchBorder.java    License: Apache License 2.0 4 votes vote down vote up
public LuckNinePatchBorder(Insets insets, BufferedImage img)
{
    this.insets = insets;

    this.np = new SwingNinePatch(img);
}
 
Example 7
Source Project: littleluck   Source File: LuckNinePatchBorder.java    License: Apache License 2.0 4 votes vote down vote up
public LuckNinePatchBorder(Insets insets, SwingNinePatch np)
{
    this.insets = insets;

    this.np = np;
}
 
Example 8
Source Project: littleluck   Source File: LuckTitlePanel.java    License: Apache License 2.0 4 votes vote down vote up
public LuckTitlePanel(boolean isResizeableOnInit, int initStyle)
{
    setOpaque(false);

    setLayout(createLayout());

    this.isResizeableOnInit = isResizeableOnInit;

    this.initStyle = initStyle;

    this.state = JFrame.NORMAL;

    Object obj = UIManager.get(LuckRootPaneUIBundle.TITLEPANEL_BG_IMG);

    if(obj != null)
    {
        np = new SwingNinePatch((BufferedImage) obj);
    }

    installTitle();

    installBtn();
}
 
Example 9
Source Project: littleluck   Source File: LuckTitlePanel.java    License: Apache License 2.0 4 votes vote down vote up
public void setBackgroundNP(SwingNinePatch np)
{
    this.np = np;
}