freeseawind.ninepatch.swing.SwingNinePatch Java Examples

The following examples show how to use freeseawind.ninepatch.swing.SwingNinePatch. 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
Source File: NinePatchImageIcon.java    From xyTalk-pc with GNU Affero General Public License v3.0 5 votes vote down vote up
public NinePatchImageIcon(URL urlRes) {
	BufferedImage img = null;
	try {
	    img = ImageIO.read(urlRes);
	    mNinePatch = new SwingNinePatch(img);
	} catch (IOException e) {
	}
	
}
 
Example #2
Source File: LuckInternalFrameTitlePane.java    From littleluck with 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 File: SwingTest.java    From NinePatch with 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 File: LuckUtils.java    From littleluck with Apache License 2.0 4 votes vote down vote up
public static SwingNinePatch createNinePatch(String imageKey)
{
    return new SwingNinePatch(getUiImage(imageKey));
}
 
Example #5
Source File: LuckUtils.java    From littleluck with 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 File: LuckNinePatchBorder.java    From littleluck with 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 File: LuckNinePatchBorder.java    From littleluck with 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 File: LuckTitlePanel.java    From littleluck with 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 File: LuckTitlePanel.java    From littleluck with Apache License 2.0 4 votes vote down vote up
public void setBackgroundNP(SwingNinePatch np)
{
    this.np = np;
}