我想使用JProgressBar它必须在一秒钟内加载.我不想等待任何任务完成.只想在一秒钟内填写进度条.所以我写下面的代码.但它不起作用.进度条没有填补.我是Java新手.请任何人都可以帮助我.
public void viewBar() {
progressbar.setStringPainted(true);
progressbar.setValue(0);
for(int i = 0; i <= 100; i++) {
progressbar.setValue(i);
try {
Thread.sleep(10);
} catch (InterruptedException ex) {
JOptionPane.showMessageDialog(null, ex.getMessage());
}
}
progressbar.setValue(progressbar.getMinimum());
}
这是我的表格:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<form action="register_ajax.php" method="get">
<input type="text" name="email">
<input type="submit" value="test">
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是我的PHP代码:
<?php
$dbc = mysqli_connect("localhost","root","*******","continental_tourism") OR die(mysqli_connect_error());
$email = $_GET['email'];
$query = "SELECT email FROM customer_info WHERE email = '$email' ";
$r = mysqli_query($dbc, $query) OR die(mysqli_error($dbc));
if($r)
echo "Email address exists!";
else
echo "sss";
?>
Run Code Online (Sandbox Code Playgroud)
如果我输入正确的(db上的现有电子邮件)$r是真的.但如果我输入不存在的电子邮件,那也是$r如此.这是为什么?基本上我想检测空集.我该怎么做?
谢谢!
我使用以下方法来调用php:
function validateEmaiAjax(email){
val = null;
$("#warning").load("https://localhost/Continental%20Tourism/register_ajax.php",{email: email}, function(rspns, stat, xml){
val = rspns;
});
if(val == ".")
return true;
else {
return false;
}
}
Run Code Online (Sandbox Code Playgroud)
我的PHP代码是:
<?php
$dbc = mysqli_connect("localhost","root","pass","continental_tourism") OR die(mysqli_connect_error());
$email = $_REQUEST['email'];
$query = "SELECT email FROM customer_info WHERE email = '$email' ";
$r = mysqli_query($dbc, $query) OR die(mysqli_error($dbc));
if(mysqli_num_rows($r) > 0)
echo "Email address exists!";
else
echo ".";
?>
Run Code Online (Sandbox Code Playgroud)
基本上这会检查数据库,如果存在电子邮件显示"存在电子邮件地址!" 如果不是我想return true(所以我回应"."并比较它).奇怪的是,如果我在if(val == ".")程序附近使用firebug设置断点并且返回true.如果我删除该断点函数总是返回false.我不明白为什么会这样.请帮忙!谢谢.
在我的程序中,我有两个JFrame实例.当我单击next按钮时,我想显示下一帧并隐藏当前帧.所以我使用this.setVisible(false)和新的Next().setVisible(true).但是在Next窗口中,如果我单击back按钮,我想将前一帧设置为再次可见,并且必须结束下一帧(这意味着必须退出).
有没有特殊方法可以做到这一点?我该怎么做?
我想改变JLabel的背景颜色.setBackground()不管用.它没有改变颜色.这是我的代码:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Test1 implements AdjustmentListener {
static JScrollBar sbarR, sbarG, sbarB;
static JLabel lbl;
static JPanel panel2;
static int r, g, b;
static Test1 nb;
public static void main(String[] args) {
nb = new Test1();
JFrame frame = new JFrame("Test");
frame.setLayout(new GridLayout(1,2));
frame.setBounds(100, 100, 200, 200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel1 = new JPanel();
panel1.setLayout(new GridLayout(1, 3));
panel2 = new JPanel();
lbl = new JLabel();
lbl.setOpaque(true);
sbarR = new JScrollBar(Adjustable.VERTICAL, 0, 1, 0, …Run Code Online (Sandbox Code Playgroud) 我想实现一个可以在添加新值时增加的数组.就像在Java中一样.我不知道该怎么做.任何人都可以给我一个方法吗?
这是为了学习目的,因此我无法使用std::vector.
我正在按照本教程尝试教科书反应应用程序。但是,当我运行命令sh -c webpack --watch -d --output ./target/classes/static/built/bundle.js(npm run-script watch如教程中所述)时,我收到以下错误。
[webpack-cli] Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema.
- configuration.devtool should match pattern "^(inline-|hidden-|eval-)?(nosources-)?(cheap-(module-)?)?source-map$".
BREAKING CHANGE since webpack 5: The devtool option is more strict.
Please strictly follow the order of the keywords in the pattern.
Run Code Online (Sandbox Code Playgroud)
我的 webpack.config.js 如下。
let path = require('path');
module.exports = {
entry: './src/main/js/App.js',
devtool: 'source-map',
cache: true,
mode: 'development',
output: …Run Code Online (Sandbox Code Playgroud) 在我的JAVA程序中有这样的代码:
int f_part = (int) ((f_num - num) * 100);
Run Code Online (Sandbox Code Playgroud)
f_num是double,num是long.我只想将小数部分取出并将其分配给f_part.但有时候f_part值比它的值小1.这意味着如果f_num = 123.55和num = 123,但f_part等于54.它只发生f_num而num大于100.我不知道为什么会发生这种情况.请有人解释为什么会发生这种情况以及纠正它的方法.
我有java代码连接MySQL和反向数据.我有以下代码,它总是给出SQLSyntaxErrorException并说第1行有语法错误.我无法理解为什么.请帮我.我可以肯定这些名字是正确的.
private void saveDetails(int slct) throws SQLException {
if(slct == ADD_NEW_RECORD) {
String query = "INSERT INTO emp(?,?,?,?,?,?,?,?,?,?,?,?,?,?) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
PreparedStatement st = Main.db.con.prepareStatement(query);
st.setString(1, "epfno");
st.setString(2, "fname");
st.setString(3, "lname");
st.setString(4, "sex");
st.setString(5, "nid");
st.setString(6, "address");
st.setString(7, "birthday");
st.setString(8, "position");
st.setString(9, "tpno");
st.setString(10, "fathername");
st.setString(11, "mothername");
st.setString(12, "m_status");
st.setString(13, "comments");
st.setString(14, "photo_id");
st.setInt(15, emp.epfno);
st.setString(16, emp.fname);
st.setString(17, emp.lname);
st.setInt(18, emp.sex);
st.setString(19, String.copyValueOf(emp.nid));
st.setString(20, emp.address);
st.setDate(21, emp.birthday);
st.setString(22, emp.position);
st.setString(23, emp.tpno);
st.setString(24, emp.fathername);
st.setString(25, emp.mothername);
st.setBoolean(26, emp.m_status);
st.setString(27, emp.comments);
st.setString(28, …Run Code Online (Sandbox Code Playgroud) 如果我在不使用任何托管代码的情况下在Visual C++中编写C++代码,它仍在CLR上运行吗?如果是,我如何使用Visual C++编写本机应用程序.有什么办法吗?