7
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

processing3でAWT/swingを使う。

Posted at

#コード

sample.pde
import processing.awt.*;
import java.awt.*;
import javax.swing.*;
void setup(){
  size(100,100);
  Canvas canvas =(Canvas)surface.getNative();
  JLayeredPane pane =(JLayeredPane)canvas.getParent().getParent();
  JTextField field=new JTextField("");
  field.setBounds(10,height*3/4,100,20);
  pane.add(field);
  ellipse(0,0,100,100);
}

void draw(){
}

投稿用12.png

pane.add(Component c)でprocessingにコンポーネントを追加することができます。

また、paneにはレイアウトがないためsetBoundsがないと表示されないです。

ではでは

#こちらも合わせてどうぞ
[swingの中にprocessingを埋め込む]
(http://qiita.com/hotman78/items/65f84e52560cc093d37f)
PSurfaceまとめ
javaからPAppletのインスタンスを作らずに、processingのメソッドを呼び出す方法

7
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?