package com.mygdx.game;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
public class RectrenderTest extends ApplicationAdapter {
private ShapeRenderer shapeRenderer;
private float alpha = 1f;
private float dAlpha = -0.5f;
private boolean fadingOut = true;
@Override
public void create() {
shapeRenderer = new ShapeRenderer();
}
@Override
public void render() {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
// Включается блендинг:
Gdx.gl.glEnable(GL20.GL_BLEND);
Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
// Задается форма:
shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
update(Gdx.graphics.getDeltaTime());
// Задается цвет и прозрачность alpha:
shapeRenderer.setColor(new Color(1, 1, 1, alpha));
// Рисуется линия:
shapeRenderer.line(0, 0, 470, 350);
shapeRenderer.end();
// Выключается блендинг:
Gdx.gl.glDisable(GL20.GL_BLEND);
}
private void update(float dt) {
// System.out.println("dt=" + dt + ", alpha=" + alpha + ", dAlpha=" + dAlpha);
// Если прозрачность за пределами допустимых значений, меняем направление
if (fadingOut && alpha <= 0 || !fadingOut && alpha >= 1f) {
dAlpha = -dAlpha;
fadingOut = !fadingOut;
}
alpha += dAlpha * dt;
}
@Override
public void dispose() {
shapeRenderer.dispose();
}
}
sb.begin();
Texture unnamed = new Texture("unnamed.png");
int width = unnamed.getWidth();
int height = unnamed.getHeight();
sb.draw(unnamed, 350, 350, width, height, 0, 0, width, height, true, false);
sb.end();
sb.begin();
Texture unnamed = new Texture("unnamed.png");
Sprite sprite = new Sprite(unnamed);
sprite.flip(true, false);
sprite.setCenter(700, 600);
sprite.draw(sb);
sb.end();
Yes it is normal.
There have been some changes in JDK8 that prevent AS7 and current version of EAP6 to start under JDK8.
We have many JDK8 related fixes in WildFly so I would recommend you to use that.
As for EAP goes, the start up on JDK8 is fixed in upcoming 6.2 release.
So in short, I would be more then welcome if people would test WildFly on JDK8 as we are working on making whole testsuite pass on it.
Class.forName("org.h2.Driver");
Connection conn = DriverManager.getConnection("jdbc:h2:tcp://localhost:9092/~/Downloads/h2/mydb", "sa", "");
PreparedStatement ps = conn.prepareStatement("select PDF from FILES");
ResultSet rs = ps.executeQuery();
Blob blob = null;
if (rs.next()) blob = rs.getBlob("PDF");
if (blob != null) {
File myPdf = new File("mypdf.pdf");
ByteArrayInputStream is = new ByteArrayInputStream(blob.getBytes(0, (int) blob.length()));
FileOutputStream fos = new FileOutputStream(myPdf);
byte[] buf = new byte[is.available()];
is.read(buf, 0, buf.length);
fos.write(buf);
is.close();
fos.close();
}
import org.jnativehook.GlobalScreen;
import org.jnativehook.NativeHookException;
import org.jnativehook.keyboard.NativeKeyEvent;
import org.jnativehook.keyboard.NativeKeyListener;
public class KeyEventDemo implements NativeKeyListener {
public static void main(String[] args) {
try {
GlobalScreen.registerNativeHook();
}
catch (NativeHookException ex) {
System.err.println(ex.getMessage());
System.exit(1);
}
GlobalScreen.addNativeKeyListener(new KeyEventDemo());
}
@Override
public void nativeKeyPressed(final NativeKeyEvent nativeKeyEvent) {
System.out.println("Key code: " + nativeKeyEvent.getKeyCode()
+ ", raw code: " + nativeKeyEvent.getRawCode());
}
@Override
public void nativeKeyReleased(final NativeKeyEvent nativeKeyEvent) {}
@Override
public void nativeKeyTyped(final NativeKeyEvent nativeKeyEvent) {}
}
@param rawCode the hardware code associated with the native key in this event.
compile "com.badlogicgames.box2dlights:box2dlights:1.4"
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import java.util.Random;
public class Test {
private final static int MAX = 999_999;
private final static int MIN = 100_000;
private final static int IMAGE_WIDTH = 50;
private final static int IMAGE_HEIGHT = 10;
private final static int FONT_SIZE = 12;
private final static int TEXT_COORD_X = 0;
private final static int TEXT_COORD_Y = 10;
private final static String FILEPATH_TO_SAVE = "/home/max/Pictures/image.jpeg";
public static void main(String[] args) {
BufferedImage image = new BufferedImage(IMAGE_WIDTH, IMAGE_HEIGHT, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2 = image.createGraphics();
g2.setFont(new Font("SansSerif", Font.PLAIN, FONT_SIZE));
g2.drawString(getRandomNumber().toString(), TEXT_COORD_X, TEXT_COORD_Y);
try {
ImageIO.write(image, "jpeg", new File(FILEPATH_TO_SAVE));
} catch(IOException ex) {
ex.printStackTrace();
}
}
private static Integer getRandomNumber() {
Random random = new Random();
return random.nextInt((MAX - MIN) + 1) + MIN;
}
}
Response res = Jsoup
.connect("/url/to/login")
.data("input[login]", "admin")
.data("input[pass]", "QWERTY1234")
.method(Method.POST)
.execute();
Document doc = res.parse();
Document doc2 = Jsoup
.connect("/url/to/file")
.cookies(res.cookies())
.get();
String htmlTag = htmlArray.get(i);
if (htmlTag != null && htmlTag.contains(strSourceTag)) ///вот тут нпе
arrayPoimey.add(htmlTag);