小编aer*_*jun的帖子

访问C#中的路径被拒绝错误

我已经阅读了类似的帖子,但我无法弄清楚问题.

我更改了Windows权限并更改了路由.

当我尝试保存文件时,它会抛出异常:

访问路径****被拒绝.

string route="D:\\";
FileStream fs = new FileStream(route, FileMode.Create); <--here is the problem
        StreamWriter write = new StreamWriter(fs);
        patient person = new patient();
        patient.name = textBox1.Text;
        patient.name2 = textBox2.Text;
Run Code Online (Sandbox Code Playgroud)

c# filestream access-denied

46
推荐指数
3
解决办法
11万
查看次数

命名JTable中的列

我正在为一家小商店开发一个程序.当我单击"报告"按钮时,它必须显示一个表,如下所示:

在此输入图像描述

列名"A","B"......"N"必须是员工的姓名.但我无法弄清楚如何.这是我的代码:

public void Inform()
{
    String[] employee;
    String[] product[];
    this.setLayout(null);

    Inform=new JTable(nulo, employee.length);

     model = new DefaultTableModel() {

            private static final long serialVersionUID = 1L;

            @Override
            public int getColumnCount() {
                return 1;
            }

            @Override
            public boolean isCellEditable(int row, int col) {
                return false;
            }

            @Override
            public int getRowCount() {
                return Inform.getRowCount();
            }
        };

        headerTable = new JTable(model);

       for (int i = 0; i < Inform.getRowCount(); i++) 
            headerTable.setValueAt(product[i], i, 0);


        headerTable.setShowGrid(false);
        headerTable.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        headerTable.setPreferredScrollableViewportSize(new Dimension(50, 0));
        headerTable.getColumnModel().getColumn(0).setPreferredWidth(50);

        scrollPane = new JScrollPane(Inform); …
Run Code Online (Sandbox Code Playgroud)

java swing jtable jframe

5
推荐指数
1
解决办法
4万
查看次数

上传时无法创建临时文件

尝试使用表单和PHP / IIS 7上传文件时,出现以下消息:

PHP Warning:  File upload error - unable to create a temporary file in Unknown on line 0
Run Code Online (Sandbox Code Playgroud)

我的表格:

<form action="acciones.php" id="form3" method="POST" enctype="multipart/form-data">
    <input type="hidden" value="3" name="accion">
    <input type="text" name="nombre" placeholder="Nombre">
        <input type="file" name="imagen" accept="image/x-png, image/gif, image/jpeg" />
    <input type="button" id="envio" class="button azul" value="Agregar" onclick="envios()">
</form>
Run Code Online (Sandbox Code Playgroud)

我的PHP代码和参考:

$target = "/images/";
$target = $target . basename( $_FILES['imagen']['name']);
//This gets all the other information from the form
$name=$_POST['nombre'];
$pic=($_FILES['imagen']['name']);

//Writes the information to the database
$query = "INSERT …
Run Code Online (Sandbox Code Playgroud)

php forms iis upload

5
推荐指数
1
解决办法
7899
查看次数

使JTable可滚动

我正在尝试创建一个有2列的JTable,一个必须显示产品的名称,第二个,价格.问题是JTable非常小,所以我需要一个滚动,但我不能创建它.

在此输入图像描述

DefaultTableModel model = new DefaultTableModel();
    JTable productos = new JTable(model);


    model.addColumn("Product");//name of the first columns
    model.addColumn("Price");//name of the second columns
    BTW: the table doesn't show the name of the column, but creates the 2 columns


    for (i=0; i<null_copy4; i++)//null_copy4 is a integer that shows me how many stacks are used in the array
    {
        model.insertRow(model.getRowCount(), new Object[]{product_copy3[i],price_copy3[i]});
    }
           //product_copy3 and price_copy3 are arrays. String[] and integer[].
    products.setBounds(5,50,200,200); //define the dimensions of the JTable
    this.add(productos);//add it to the window
Run Code Online (Sandbox Code Playgroud)

java swing jtable jframe jscrollbar

3
推荐指数
1
解决办法
786
查看次数

标签 统计

java ×2

jframe ×2

jtable ×2

swing ×2

access-denied ×1

c# ×1

filestream ×1

forms ×1

iis ×1

jscrollbar ×1

php ×1

upload ×1